Also store the player's frame ID
ClosedPublic

Authored by broulik on May 5 2019, 8:54 PM.

Details

Summary

The extension is also injected into iframes on a website. They share the same tab id as the rest of the website, so when having multiple videos embedded as iframes, they all get mpris signals relayed to them, causing e.g. a play command to suddenly start playing all of them.
This patch introduces a playerId which is basically tabId-frameId (with "0" being the main page) and uses that for identifying players.
The code is also simplified a bit by having a sendPlayerTabMessage function which checks for a player being present (instead of having the caller do that everywhere) and then sends it to the appropriate tabId and frameId combination.

Test Plan

I started the video at the bottom of [1], hit pause in media controller, hit play in media controller.
Previously all the videos would start playing as they're separate embedded iframes and all got signalled the play request.
With this patch only the relevant video is controlled. Tested play, pause, seeking, volume change. Closing the tab unregisters the player as normal.
[1] https://www.winhistory.de/more/nt351.htm

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.May 5 2019, 8:54 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 5 2019, 8:54 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.May 5 2019, 8:54 PM
broulik edited the summary of this revision. (Show Details)
broulik updated this revision to Diff 57633.May 6 2019, 9:20 AM
  • Don't mutate while iterating

Couldn't find anything wrong, but I'm currently missing the overview of all MPRIS stuff in here to actually review properly...

This revision was not accepted when it landed; it landed in state Needs Review.Jun 3 2019, 7:04 AM
This revision was automatically updated to reflect the committed changes.