Add hack to unbreak audio playback through pure JS via new Audio()
ClosedPublic

Authored by broulik on Apr 25 2019, 8:12 PM.

Details

Summary

Let the comment in the code speak for itself. Now, where is my jug of disinfecting agent...

BUG: 406947

Test Plan

Google translate works again and so does https://www.radio.net/s/cinemix for which I originally added this.

Can also control them via p-b-i

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.Apr 25 2019, 8:12 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 25 2019, 8:12 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Apr 25 2019, 8:12 PM
fvogt added a comment.Apr 25 2019, 8:30 PM

I'm not sure why this is necessary - during new Audio the created object can't play anything by itself as src is not set.
If just doing createdAudio.paused = false after the removeChild is not enough, is that because the DOM modifications are queued and executed after the audio started playing?

Here I can let google translate speak and play the radio just fine, but neither of them are visible to pbi. So race condition, browser differences or bug?

Looks like a recent policy change in Chrome, only my Chrome 74 seems affected and I recall it working half a year ago when I implemented this feature.

apol added a subscriber: apol.EditedJun 22 2019, 12:42 PM

+1 Fixes the issue for me.

fvogt accepted this revision.Jul 20 2019, 3:36 PM
This revision is now accepted and ready to land.Jul 20 2019, 3:36 PM
fvogt added a comment.Jul 20 2019, 3:41 PM

Still can't reproduce, but doesn't seem to intruduce a regression either

broulik edited the summary of this revision. (Show Details)Jul 21 2019, 10:01 AM
This revision was automatically updated to reflect the committed changes.