-1

I write HTML/JS code for HTML5 video player and have a error in Firefox 27.0.1 version, In Ubuntu/Windows Chrome in works, in IE11 it works.

HTML

<div id="newprogressBar" style="border:1px solid #aaa; color:#fff; width:295px; height:20px;"><span id="newprogress" style="background-color:#ff0000; height:20px; display:inline-block;"></span></div>

JS in HTML

var video = document.getElementById("videoPlayer"), (HTML5 <video *.mp4>)
newprogressBar = document.getElementById("newprogressBar");
newprogress = document.getElementById("newprogress");

Event function in JS

newprogressBar.addEventListener('click', function(event) {
width = parseFloat(newprogressBar.style.width);
var x = event.offsetX / width; 
video.currentTime = Math.round(x * video.duration);
}, false); 

I have an error on this line in Firefox

video.currentTime = Math.round(x * video.duration);

Error:

TypeError: Value being assigned to HTMLMediaElement.currentTime is not a finite floating-point value.

Maxwell
92610 silver badges17 bronze badges
asked Mar 1, 2014 at 19:49
5
  • 2
    What are x and video.duration? Commented Mar 1, 2014 at 19:55
  • Sounds like it's NaNing. Commented Mar 1, 2014 at 19:57
  • 1
    Looks like a relevant question here: stackoverflow.com/questions/11334452/event-offsetx-in-firefox Commented Mar 1, 2014 at 19:57
  • 1
    You should put console.log(width, x, x * video.duration) in your code to see what's going on. I'm sure one of those values is NaN. Commented Mar 1, 2014 at 19:59
  • NaN it's true, nut why only in firefox? x - it's temp variable for debug. I need to create navigation on video, i see where user click and do thing like this (Max width - selected) Commented Mar 1, 2014 at 20:09

1 Answer 1

1

Check for .webm video file within video tag. Firefox on linux (also maybe on other OS) doesn't play .mp4 files.

answered Mar 15, 2015 at 19:33
Sign up to request clarification or add additional context in comments.

1 Comment

It needs the gstreamer plugin.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.