Open Bug 1473457 Opened 6 years ago Updated 2 years ago

Dispatching ended event on MediaStreamTrack with dispatchEvent does not call handler added with addEventListener

Categories

(Core :: Audio/Video: Playback, defect, P3)

60 Branch
defect

Tracking

()

Tracking Status
firefox-esr60 --- affected
firefox61 --- unaffected
firefox62 --- unaffected
firefox63 --- affected

People

(Reporter: leahcimic, Unassigned, NeedInfo)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce:

Listen for ended event on MediaStreamTrack using addEventListener
Dispatch ended event on MediaStreamTrack.

Reduced test case:
https://jsbin.com/rinikivafi/1/edit?js,console,output


Actual results:

The event handler was never called.

(Although if you set the property onended, it is indeed called).


Expected results:

The event handler should have been called.

Works in Chrome 67.0.3396.99.
Works in Edige 42.17134.0 (EdgeHTML 17.17134)
Works in Safari 11.1.1 (13605.2.8)
Does not work Firefox Stable 60.0.2 (64-bit)
Does not work Firefox Nightly 63.0a1 (2018-07-04) (64-bit)

Testing for Chrome/Firefox was done in Ubuntu.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
I tested this in latest stable 60.0.2 (64-bit), and it is no longer an issue.
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Apologies, I resolved the wrong bug.
Note: when the webcam is stopped by revoking access, the event handler added with addEventListener does get called
User Agent:  Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0 
Build ID: 20180710100040         
I manage to reproduce this issue on Ubuntu 18.04 x 64 with Firefox Nightly 63.0a1 (2018-07-06) (64-bit). Please note that this issue is also displayed on Windows 10 x64.
Status: UNCONFIRMED → NEW
Component: Untriaged → Audio/Video: Playback
Ever confirmed: true
Product: Firefox → Core

Since the bug is still present, the only way to react on MediaStreamTrack events from within Firefox is to use the event handler properties onended, onmute, onunmute. However, this only allows one callback to be assigned. If the same track is used by different consumers, they possibly will overwrite the callbacks of others.

Having a working addEventListener on the MediaStreamTrack would be very helpful. Also, the documentation doesn't have a hint that this does not work on Firefox, e.g. addEventListener is used as an example here.

The bug also reproduces here on Firefox 93.0 (Mac OS 10.15).

:jib, is this within your purview?

No longer blocks: media-triage
Flags: needinfo?(jib)
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.