Jump to content

click to play <video> error in firefox


ala888

Recommended Posts

Basically, if I code something like

onclick="functionx()"

function x()

{if(video.paused){

video.play();

}else

{video.pause();

}

}

 

works fine in chrome. Problem is, in mozilla firefox, this function is already built into the browser - so when the user clicks

the video to play it, it starts and stops almost immediately. How do I work around this? Browser detection is out the door due to reliability issues.

Link to comment
Share on other sites

IF this is the html5 video this already uses a type of browser detection, in that not all the browsers will play a specific format yet! so you have to list different formats (mp4, ogg, webm) of the same video then the correct format is chosen on loading of page for playing.

 

http://www.w3schools.com/html/html5_video.asp

 

Also you may have to use .load() for the video, before you can use play().

Link to comment
Share on other sites

I don't know if it's a typo, but it should just be

onclick="x()"

I'm not sure what you mean by the function being built into the browser. Which one? x? play, pause? Are you there aren't just errors in the console you aren't seeing?

 

Also, it is encouraged and preferred to use code tags on the forums when providing code snippets in posts.

Link to comment
Share on other sites

I mean the whole

onclick(pause/play)

is already built into mozilla web browser, while it isnt on something else like chrome.

when you click the video on chrome, nothing happens without this script. but if you do on mozilla, it will still play without script.So when the same script runs on mozilla, its essentially running 2x - resulting in the video NOT playing.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...