Closed Bug 949129 Opened 11 years ago Closed 6 years ago

HTML5 audio properties currentTime and duration don't seem to work

Categories

(Firefox OS Graveyard :: AudioChannel, defect, P3)

ARM
Gonk (Firefox OS)
defect

Tracking

(tracking-b2g:backlog)

RESOLVED WONTFIX
tracking-b2g backlog

People

(Reporter: thulfram, Unassigned)

Details

Attachments

(1 file)

Attached file index.html
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release)
Build ID: 20131209004003

Steps to reproduce:

Ran the attached code, first in desktop and then in Firefox OS B2G. Audio properties of duration and currentTime works as expected on desktop, but not in B2G simulator and phone.



Actual results:

It works in B2G 27.0a2 (2013-12-09) on desktop but the following two errors occur when run in the simulator (or my ZTE Open).

1. Duration displays "Infinity" when the controls displays 19. 
2. currentTime is set to 10 seconds, but starts at the beginning.

Also, I shouldn't have to remove the onplaythrough event, but this may relate to bugs 773883 and 773885.


Expected results:

Duration should display programmatically. I think it is NaN.

The song should start at 10 seconds into the file. 

Why does this matter? It will be difficult to create audio sprites (load one file, pick the audio you want to play from a location in a file). See Chris Heilmann's post at https://hacks.mozilla.org/2012/04/html5-audio-and-audio-sprites-this-should-be-simple/. Chris's post doesn't work in B2G.
blocking-b2g: --- → backlog
OS: All → Gonk (Firefox OS)
Priority: -- → P3
Hardware: All → ARM
blocking-b2g: backlog → ---
HTMLMediaElement.duration doesn't return the media's lenght but actually it's the same that HTMLMediaElement.currentTime
Same issue for me. I get an "InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable1 audio.js:22:0" error message when trying to set a value for audio.currentTime when using Firefox for Android 40.0.

Here is my code:
  var audio = document.getElementById("audio");
  var pos = myArray.indexOf(val);
  audio.currentTime = pos;
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: