- Home /
Problem is not reproducible or outdated
Android video playback
I'm having problems with video playback in Android.
There is not much documentation on this, Unity docs only say to use iPhoneUtils.PlayMovie()
Is this line of code supposed to work in Android?
iPhoneUtils.PlayMovie("video.mp4",Color.black, iPhoneMovieControlMode.Hidden);
I installed Quicktime and I have Android Pro. When I deploy the application to my tablet and reach the point to play the video the screens turns black and that's it. I tried with different versions of the video (mp4 and 3gp).
The log shows:
VERBOSE/MediaPlayer-JNI(8664): native_setup VERBOSE/MediaPlayer(8664): constructor VERBOSE/MediaPlayer(8664): setListener VERBOSE/MediaPlayer-JNI(8664): seekTo: 0(msec) VERBOSE/MediaPlayer(8664): seekTo 0 ERROR/MediaPlayer(8664): Attempt to perform seekTo in wrong state: mPlayer=0x0, mCurrentState=1 ERROR/MediaPlayer(8664): message received msg=100, ext1=-38, ext2=0 VERBOSE/MediaPlayer(8664): notify(100, -38, 0) callback on disconnected mediaplayer INFO/ActivityManager(2488): Displayed activity com.qualcomm.QCARUnityPlayer/com.unity3d.player.VideoPlayer: 70 ms (total 70 ms)
Is there any working sample code using unity video playback in Android?
Avdshare Video Converter is the most professional video to Android converter with which any unsupported video can be easily converted to Android products supported video formats. See the guide:https://www.avdshare.com/convert-avi-to-android-supported-video-formats
Answer by adrianrdzv · Aug 10, 2011 at 01:11 PM
I found the problem.
I knew that the video should be placed in the Streaming Assets folder, what I didn't know is that if you place it in another folder within Streaming Assets, you should include the folder name in the iPhoneUtils.PlayMovie() call.
iPhoneUtils.PlayMovie("Movies/video.mp4",Color.black, iPhoneMovieControlMode.Hidden);
Hope this helps to anyone making this silly mistake.
somewhat related links: http://answers.unity3d.com/questions/18503/how-integrate-video-before-menu-in-unity-iphone-ga.html and http://forum.unity3d.com/threads/80109-Does-iPhoneUtils.Play$$anonymous$$ovie-work-on-Android-devices in my case the issue was the codec somehow. Videos would play on Android but not inside Unity.
Answer by aubreuil56 · Mar 30, 2015 at 09:26 AM
This issue is fixed with Unity 5, Handheld class now works if you had normal license, no need for Android Pro with Unity 5, thanks all