Bug 216874 - REGRESSION: getUserMedia video does not display correctly if acquired immediately after stopping previous stream
Summary: REGRESSION: getUserMedia video does not display correctly if acquired immedia...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 14
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: HasReduction, InRadar
Depends on:
Blocks:
 
Reported: 2020-09-23 06:11 PDT by Sergey Tatarintsev
Modified: 2020-10-12 01:58 PDT (History)
7 users (show)

See Also:


Attachments
Test case reduction (789 bytes, text/html)
2020-09-23 06:11 PDT, Sergey Tatarintsev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Tatarintsev 2020-09-23 06:11:18 PDT
Created attachment 409467 [details]
Test case reduction

If navigator.mediaDevices.getUserMedia called the second time immediately after the closing the previous camera screen, the call succeeds, but the resulting stream does not display correctly:

- assigning it to srcObject of the video element does not start the playback
- said video element does not emit any events

Adding ~500ms delay between closing the previous stream and starting the next one fixes the problem. 
It also worked correctly without a delay on Desktop Safari 13.

See attachment for reproduction.
Expected result: camera stream is playing in the video element.
Comment 1 Radar WebKit Bug Importer 2020-09-23 11:30:29 PDT
<rdar://problem/69447859>
Comment 2 Smoley 2020-09-24 17:43:16 PDT
Using the attached test case I am not able to reproduce this issue on Safari Technology Preview Release 113 (Safari 14.0.1, WebKit 15610.2.3.1).

I see the LED indicator flash as the first stream ends and the second begins but the resulting stream seems normal.
Comment 3 Davy De Durpel 2020-10-07 06:45:12 PDT
I did these 3 tests:

Safari 14 (15610.1.28.1.9) on MacOS 10.15.7
-> no issue

Safari 14 on iPadOS 14.2 (latest public beta)
-> no issue

Safari 14 on iOS 14.0.1
-> black stream


So it seems that the issue currently only exists on iOS 14 and not the 2 other operating systems.
Comment 4 youenn fablet 2020-10-07 09:53:46 PDT
(In reply to Davy De Durpel from comment #3)
> I did these 3 tests:
> 
> Safari 14 (15610.1.28.1.9) on MacOS 10.15.7
> -> no issue
> 
> Safari 14 on iPadOS 14.2 (latest public beta)
> -> no issue
> 
> Safari 14 on iOS 14.0.1
> -> black stream
> 
> 
> So it seems that the issue currently only exists on iOS 14 and not the 2
> other operating systems.

This might be a playsInline bug.
Can you fix your test case to use it?
Currently it is set as playsline
Comment 5 youenn fablet 2020-10-07 09:57:27 PDT
Did a small experiment by setting playsInline to true.
I had to call camera.play() to make it work.
Comment 6 youenn fablet 2020-10-07 10:11:35 PDT
It seems there might be a small amount of time where the session is interrupted and we do not transition automatically to play from autoplay.