iOS freezes inline videostream randomly [Bounty awarded]

Hi all,

We have a very weird problem. We’ve searched all over the place but can’t find the cause or solution.
Here’s a brief description;

On any device we can start a WebRTC video stream with ‘getUserMedia()’ this works fine. When we’re
on the receiving end we assign the stream to a video tag and it shows the live broadcast.
This works fine on Android and Web, but on iOS this stream freezes, sometimes in the first second, sometimes after 10 seconds, sometimes after a minute.

<video
	#videoElement
	[srcObject]="myVideoStream"
	controls
	autoplay
	playsinline
	webkit-playsinline></video>

When, in Angular, logging events on the videoPlayer, we never receive ANY errors.
We’ve tried manually and programmatically executing pause() and play() but then the frozen screen just disappears and we see an empty video player.
Correct answer (cause + solution) will be awarded €1000,-

The MediaStream.GetVideoTracks() function still logs a correct stream, the websocket is still alive… nothing logs any errors.
Even if I watch the same stream on any other device, I’m seeing that it’s actually still up & running.

We’ve tried to re-assign the stream after it freezes (with a button click):

this.videoElement.nativeElement.srcObject = this.myVideoStream;

Also tried to pause it first, or pause() and load() and play(), but nothing seems to work.
The only thing that works so far, is to refresh the whole service, setup a new websocket and assign the new MediaStream to the [srcObject] which will then freeze again after a short amount of time.

I’m starting to think that iOS itself decides to ‘disable’ the view?
Because there’s no other indication of any errors in the MediaStream, the VideoTracks, the Websocket or the VideoPlayer.

Does anyone has some other possible solutions?
And also… maybe a possible way to find the cause?
Because without ‘noticing’ when it goes wrong, we can’t restart the stream.
Right now a user has to click a manual ‘reconnect’ button every few moments.

Thanks in advance!

You need to create a sample project (stackblitz) and paste it here, that replicates this issue. showing few lines of code and talking about your issue, is not enough to help you fix it.

I’m afraid thats not possible, because we have a whole server architecture to enable the WebRTC streaming. And retrieving + playing the stream works on Web / Android. So you would have to build the whole project through XCode to replicate the issue on iOS…

Then i’m afraid it’s not possible for anyone to give you a answer that could point you in the right direction. Goodluck!