[Webkit-unassigned] [Bug 174327] New: Adding, removing, and then adding back same MediaStreamTrack throws InvalidAccessError
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jul 10 16:22:32 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=174327
Bug ID: 174327
Summary: Adding, removing, and then adding back same
MediaStreamTrack throws InvalidAccessError
Product: WebKit
Version: Safari Technology Preview
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: mroberts at twilio.com
It should be possible to add a MediaStreamTrack, remove it, and then add it back to an RTCPeerConnection. See the following code:
(async () => {
const stream = await navigator.mediaDevices.getUserMedia({ audio: true })
const [track] = stream.getTracks()
const pc = new RTCPeerConnection()
console.log('1. addTrack(track, stream)')
const sender = pc.addTrack(track, stream)
console.log('2. removeTrack(sender)')
pc.removeTrack(sender)
if (sender.track !== null) {
console.error('The RTCRtpSender\'s track should be set to null')
}
console.log('3. addTrack(track, stream)')
pc.addTrack(track, stream)
console.log('Success!')
})()
Expected output:
1. addTrack(track, stream)
2. removeTrack(sender)
3. addTrack(track, stream)
Success!
Actual output (Safari):
1. addTrack(track, stream)
2. removeTrack(sender)
The RTCRtpSender's track should be set to null
3. addTrack(track, stream)
Unhandled Promise Rejection: InvalidAccessError (DOM Exception 15): The object does not support the operation or argument.
(Note: In Firefox, I mostly get the expected output, except I also get the "The RTCRtpSender's track should be set to null" error.)
FWIW, I tried to workaround this by calling `sender.replaceTrack` in Step 3 instead of `sender.addTrack`. Although the code prints "Success!" in that case, I later get "Unhandled Promise Rejection: InvalidStateError (DOM Exception 11): The object is in an invalid state."
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170710/a61ae70f/attachment.html>
More information about the webkit-unassigned
mailing list