I am playing .mp4 videos in my game. The issue is that video is not working on webview for some android devices. It shows connection error (error code http : 206 ).
It works most of the time even in these devices if a user waits for like 5 minutes before going to video play sequence.
Is there any way to deal it?
Not sure about that, 5 minutes seems like a long time and a very strange bug.
Just to confirm, are you making sure the user interacts with the screen e.g. presses a button / taps somewhere before playing your video? The browser requires that the user interacts before autoplaying the video.
Everything is working fine.
It is just occurring in some devices.
Is there a way of checking if the video is loaded although it should be loaded when the game starts as its preload is set to true?
The HTTP Status Code 206 means that the server is delivering only part of the resource requested by the client due to a range header sent by the client .
It seems to be a buffer problem, doesn’t it? So the player/material are free of guilt.
This obviously explains why waiting 5 minutes helps.
Check the network layer of the problem instead, maybe those old devices have a poor network speed/latency.
I missed this part before.
Use loadeddata event , instead of canplaythrough event. The difference is that the second one starts playing when it thinks it has enough data and speed network to do so, and the first one is when it has downloaded completely.
I guess you were using this example.
Are you getting the error on published builds and/or the launch tab?
Video files are served slightly different on launch tab for video files