Searching on the internet, it seems to be related to video autoplay restriction…
Videos with sound are bloqued on Safari (from the last version)…when condidered as “autoplay”
EDIT : even videos without sounds
How do you handle this issue?
In my scenario, the video is not auto playing : the user needs to touch the lauch button (that is not in the same Class as the video player), but Safari considers it’s an autoplay!
Edit : even if the touch event is in the same Class
I am using Starling VideoTexture.
The error occurs when I call play() on my netStream:
Perhaps try using a normal MouseEvent from the OpenFL stage, not from Starling. Starling has an event queue for touch events, which disconnects the user action of tapping from the call stack that later calls your listener code.
I’ve seen similar problems with pop-ups being blocked, but only from Starling events
Unfortunatly, I encounter the same issue with OpenFL stage MouseEvent…
private function showVideo() : Void
{
_nc = new NetConnection();
_ns = new NetStream(_nc);
var client:Dynamic = {};
client.onMetaData = onMetaData;
_ns.client = client;
_asset_url = Assets.getPath(_url);
_texture = Texture.fromNetStream(_ns, 1, onTextureReady);
addClickEvent();
}
private function addClickEvent()
{
Starling.current.nativeStage.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(e:MouseEvent):Void
{
_ns.play(_asset_url); // Error in Safari
}
That is really annoying because I have two Starling AIR apps to convert to HTML5…and both use video.
And Chrome is going to put the same restriction as Safari starting in january 2018…
I also noticed that the fix works if the file extension is “.mp4” but it dispatches error if file extension is “.f4v”…
If I simply rename the file that’s ok…