Inject script on relevant video nodes not top of DOM
AbandonedPublic

Authored by davidedmundson on Jun 19 2018, 7:10 PM.

Details

Reviewers
fvogt
Summary

Turns out we're not the only script that messes with the top of the DOM,
and because we're in a separate context, we're potentially doing it in
parallel.

This moves injection into the found video node

Test Plan

Ran media sessions example

Diff Detail

Repository
R856 Plasma Browser Integration
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 132
Build 132: arc lint + arc unit
davidedmundson created this revision.Jun 19 2018, 7:10 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJun 19 2018, 7:10 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Jun 19 2018, 7:10 PM

Media sessions doesn't necessarily need a player item, it's basically meant for when you don't have one. The website might remove the player item when it pauses when it's using media sessions API to do custom handling. Can't think of a better solution, though.

Also, executeScript is used not only for this, is it?

Also, executeScript is used not only for this, is it?

Seems to be.

fvogt requested changes to this revision.Jun 20 2018, 7:54 AM
fvogt added a subscriber: fvogt.

I don't think this is a good idea - if no player exists, it'll either fail silently or throw an exception on the "element.parentNode" access.

This revision now requires changes to proceed.Jun 20 2018, 7:54 AM

Right, I should move the removeChild to before the break.
As for the other comment if there's no players, there's limited point executing the script.

davidedmundson abandoned this revision.Jun 20 2018, 11:05 AM