Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8018355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:06:42+00:00 2026-06-04T21:06:42+00:00

In my application I need to make sure that a user has set a

  • 0

In my application I need to make sure that a user has set a video as source of my html5 video player, before continuing with the other actions. So I tried this (using Firebug in Firefox):

When user has set a source for the videoplayer

vp = $('#myvideoplayer')
vp.attr('src')  --> "blob:5c254454-6c4e-4b69-b381-9ad60d6b1c4a"

when no source is set for the video

vp.attr('src')  --> undefined

Can I use this to detect if a user has set the video source or not?

if(vp.attr('src') != undefined){
   let_user_do_next_action();
}

Or is there any better way?

p.s:

I am setting the source of video using an HTML5 file input widget as follows. (This works only in Firefox, since Chrome doesn’t allow createObjectURL from window.webkitURL for some reason.)

var file = $('#fileselect').get(0).files[0];
if (file==undefined){
    alert('no file chosen');
}
var myURL = window.URL || window.webkitURL;
var fileURL = myURL.createObjectURL(file);
if(fileURL){
    player = $('#myvideoplayer');
    player.src=fileURL;
    player.load();
}
return;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:06:43+00:00Added an answer on June 4, 2026 at 9:06 pm

    That code should work, or if you want to be foolproof, check typeof vp.attr('src') == "undefined".Though if you don’t use jQuery you might want to check element.hasAttribute("src") instead.

    About window.webkitURL.createObjectURL, I think Chrome restricts stuff when you’re testing it locally (e.g. on a file:// URL), and you’d either have to set up a simple HTTP server on localhost, or start Chrome with --allow-file-access-from-files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my C#/MVC4/Razor Application I need to make sure that user enter not only
In my application I need to make something happen when an EditText loses its
For my iphone application I need to make a request to the server with
I have a relatively simple application which I need to make native Mac OSX
I'm trying to test an application and I need to make an valid IP
I have been developing an asp.net mvc application where i need to make large
I need to make application with GUI interface and I want to take a
I need to make a .net application where I must detect a specific object
I need to make an HTTPS request from my application in order to fetch
I need to make a distribution build for my application. Im using Core Plot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.