Bug 207041 - Audio is not played from an audio element when the srcObject object has unstarted video tracks
Summary: Audio is not played from an audio element when the srcObject object has unsta...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-31 06:55 PST by Philipp Hancke
Modified: 2020-03-16 18:12 PDT (History)
9 users (show)

See Also:


Attachments
Patch (10.75 KB, patch)
2020-03-16 06:33 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hancke 2020-01-31 06:55:17 PST
Once upon a time Chrome didn’t play audio on an audio element when the element’s srcObject contained a video track that hadn’t sent any data:
  https://bugs.chromium.org/p/chromium/issues/detail?id=738379
The reason was/is that for *video* elements loadedmetadata/onresize need to be fired which are not known without a (key)frame. Since audio elements don't fire these events they can just play.

This is still an issue in Safari as demonstrated by this fiddle:
  https://jsfiddle.net/47uvs3gt/
This reproduces a situation where a MediaStream with audio and video tracks is created on the receiving end but the sender does not send rtp packets.
This can very easily happen from Firefox (see https://github.com/w3c/mediacapture-main/issues/642) and also when an implementation makes an effort to ensure the camera light is turned off in other browsers.

https://jsfiddle.net/kcutdvhe/ - the stream splitting approach which used to work in Chrome also seems to work but would be great to avoid.

Note that https://jsfiddle.net/23s0odra/ which attempts to reproduce this without a RTCPeerConnection in between still works. But maybe because the video track readyState is ended?
Comment 1 Radar WebKit Bug Importer 2020-01-31 21:54:26 PST
<rdar://problem/59084745>
Comment 2 youenn fablet 2020-03-16 06:33:14 PDT
Created attachment 393651 [details]
Patch
Comment 3 WebKit Commit Bot 2020-03-16 09:36:42 PDT
Comment on attachment 393651 [details]
Patch

Clearing flags on attachment: 393651

Committed r258503: <https://trac.webkit.org/changeset/258503>
Comment 4 WebKit Commit Bot 2020-03-16 09:36:44 PDT
All reviewed patches have been landed.  Closing bug.