Wait for duration to be known before registering player
ClosedPublic

Authored by broulik on Sep 24 2018, 11:11 AM.

Details

Summary

A player might emit a play signal before its duration is known.
We want to avoid controlling short sounds (e.g. chat notifications) but I found the duration often is NaN on first invication when the sound is loaded for the first time.
Defer activating the player until we get a durationchange event for that player

Test Plan
  • No longer have it trying to control Facebook Messenger notification sounds
  • YouTube still works fine
  • Some random music stream (duration of Infinity) still works
  • HTML Media sessions example (both video and audo) still work fine

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Sep 24 2018, 11:11 AM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 24 2018, 11:11 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Sep 24 2018, 11:11 AM
fvogt added inline comments.Sep 24 2018, 11:15 AM
extension/content-script.js
106

Missing e

326

Is the pendingActivePlayer check necessary here?

broulik added inline comments.Sep 24 2018, 11:16 AM
extension/content-script.js
326

We don't want to randomly switch players when they happen to change their duration, don't we? Or are you refering to me checking for pendingActivePlayer not being null?

fvogt added inline comments.Sep 24 2018, 11:18 AM
extension/content-script.js
326

The latter. player can't be null anyway.

broulik updated this revision to Diff 42229.Sep 24 2018, 11:19 AM
  • Fix typo
  • Simplify check
fvogt accepted this revision.Sep 24 2018, 11:24 AM
This revision is now accepted and ready to land.Sep 24 2018, 11:24 AM
This revision was automatically updated to reflect the committed changes.