Ios issue

Oleksandr

New Member
Hello. I'm using flashphoner, and I have an issue with ios devices.
The first screenshot is the sample code from your website.
first.png
It works great, but if i use setTimeout method, like at second screenshot,
second.png
i get an error.
third.png

it's only about stream play, with publish all OK.
also if the setTimeout's timeout less then 1000s it works too.
To reproduce you should open two tabs
In first tab you should start stream. at second tab try to play stream.
Also use user-agent Safari-ios-iphone
It's critical for me, because i need to start stream when i get some asynchronous event, not when i click some button. SetTimeout just emulates than event.
 
Last edited:

Max

Administrator
Staff member
Hello
In iOS Safari 11 there is a fundamental problem with this.
In order to start playing video on the page, user activity is required and this activity should occur in the main thread of execution, which causes playback in the <video> tag.
That's why we added code that calls the Flashphoner.playFirstVideo (remoteVideo) method by clicking on 'play'; and plays a static three-second clip on the remoteVideo element. As a result of this manipulation, the video element is unlocked and can play the stream.
Example:
https://wcs5-eu.flashphoner.com/client2/examples/demo/streaming/player/player.js
https://wcs5-eu.flashphoner.com/client2/examples/demo/streaming/player/player.html
Code:
if (Flashphoner.getMediaProviders()[0] === "WSPlayer") {
Flashphoner.playFirstSound();
} else if (Browser.isSafariWebRTC() || Flashphoner.getMediaProviders()[0] === "MSE") {
Flashphoner.playFirstVideo(remoteVideo);
}
This design was added in the fall of 2017, when Safari 11 came out. Now something could change in the new versions of Safari 11, but we did not check.
Therefore, try calling Flashphoner.playFirstVideo (remoteVideo); on user activity. If you can do this, then there probably will not be problems with subsequent playback through setTimeout ().
 
Top