Closed Bug 1654045 Opened 4 years ago Closed 4 years ago

Stop listening to media control keys after media reaches to the end

Categories

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

task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

Details

Attachments

(4 files)

While testing the behaviors of media control, I found that Chrome would stop listening to media control keys after the media reaches to the end.

The advantage of doing so is that, we can ensure that we won't intefere other applications because we have stopped listening to the media control keys which means abandoning the "audio focus" on the platform. And we can also remove the timer [1] related code to make our usage simpler and solve the issue for notification sound issue (we don't want the notification sound to intefere other applications).

The disadvantage is that, we are not able to control media via media control keys once it reaches to the end. User have to manually start media via mouse clicking or keyborad pressing to start media from the control interface website provides. However, I don't really know how many people would want to control media via our media control after media reaches to the end. If no one is needing that, we should probably follow Chrome's behavior.

[1] https://searchfox.org/mozilla-central/rev/9b282b34b5aa0f836beb735656c55efb2cc4c617/dom/media/mediacontrol/MediaController.cpp#196-214

I could imagine some scenarios where the video has ended and you want to restart it via keys (thinking educational videos or music). But I'm not sure that users would know for how long we allow them to do that, or why it sometimes would work for them (if they were inside that time window). It might be better to follow Chrome in this case (imo).

Attachment #9166729 - Attachment description: Bug 1654045 - part4 : add test to ensure we would stop controlling media when it reaches to the end. → Bug 1654045 - part4 : add a test to ensure we would stop controlling media when it reaches to the end.
Attachment #9166727 - Attachment description: Bug 1654045 - part2 : add 'onactivechange' and 'isActive' on the media control webidl interface. → Bug 1654045 - part2 : add 'onactivate/ondeactivate' event handlers and 'isActive' on the media control webidl interface.
Attachment #9166727 - Attachment description: Bug 1654045 - part2 : add 'onactivate/ondeactivate' event handlers and 'isActive' on the media control webidl interface. → Bug 1654045 - part2 : add 'onactivated/ondeactivated' event handlers and 'isActive' on the media control webidl interface.
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/19a0d1ad43cf
part1 : stop listening to the media keys when media reaches to the end. r=chunmin
https://hg.mozilla.org/integration/autoland/rev/5640e25c2d1d
part2 : add 'onactivated/ondeactivated' event handlers and 'isActive' on the media control webidl interface. r=chunmin
https://hg.mozilla.org/integration/autoland/rev/5acecd538004
part3 : porting other attributes to media controller's webidl interface. r=chunmin
https://hg.mozilla.org/integration/autoland/rev/7df4a30f6382
part4 : add a test to ensure we would stop controlling media when it reaches to the end. r=chunmin
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: