Bug 262375

Summary: MediaStreamTrack (getUserMedia) setting is lost after cloning
Product: WebKit Reporter: Mukesh <mukeshbiswas>
Component: WebRTCAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: eric.carlson, jer.noble, youennf
Priority: P2    
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   

Description Mukesh 2023-09-29 09:02:45 PDT
I have encountered a bug in WebKit related to the cloning of MediaStreamTrack objects obtained through getUserMedia(). The cloned track loses its settings, specifically the resolution. 

This behavior is unexpected as it doesn't follow the w3c spec(https://www.w3.org/TR/mediacapture-streams/#dom-mediastreamtrack-clone)
Steps to Reproduce:

1 - Obtain MediaStream through getUserMedia()
2 - Attach it to DOM Video element. ----- Height 640, Width 360
3 - Clone the MediaStream using the stream.clone(), or construct new stream after cloning individual tracks.
4 - Attach it to DOM Video element.
5 - Repeat the step 3 and 4
6 - The resolution is lost after cloning 2nd times ----- Height 360, Width 640 

Expected Results:
The cloned MediaStreamTrack should retain all its settings, including dimensions, after cloning.

Actual Results:
The cloned MediaStreamTrack does not have the correct dimensions and may have other settings lost as well. It swaps the height and width

CodePen link: https://codepen.io/Mukesh-the-decoder/pen/VwqrpZv

Device: IPhone 16, Safari
Comment 1 youenn fablet 2023-10-03 06:04:11 PDT
Thanks for the report, I think this will be fixed with https://bugs.webkit.org/show_bug.cgi?id=261329

*** This bug has been marked as a duplicate of bug 261329 ***