Hi, I am attempting to create an app that plays video inline, using the HTML5 video tag. I need to support Android and have a problem on this platform. My app plays the video inline OK when the app is first launched, but if the app is exited via the back-button, and then re-launched, the video will not play again. I have to 'force stop' the app before it will work again. If I exit the app using the home button, and then re-launch, the video is fine and will playback again OK. This behaviour occurs whether I am playing a remotely hosted video or locally hosted video. The video format is MP4, I have not tried any other format at present. Can anyone tell me what I am doing wrong? I presume the back button needs some kind of reset or clear-up upon exiting the app, but I can't find anything about it!
I have tried catching and disabling the back button event, but that didn't seem to work at all, possibly because I am using the Ionic framework and am doing it in the wrong place.But at any rate I don't really want to disable it if I can help it.
I have KeepRunning=false in my config.xml.
I am currently using PhoneGap Build, CLI 5.2.0, Android 4.1.1, on a Samsung tablet.
My code (I am disabling the full-screen button via CSS):
<video id="vidStart" class="videoDisplay" controls="controls" webkit-playsinline> <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4"> Your browser does not support the video tag. </video>
Are you using any plugins in your app? If not, you might want to consider using the Crosswalk Plugin (https://www.npmjs.com/package/cordova-plugin-crosswalk-webview), that way you aren't having to deal with the frustrating web view glitches that occur on various Android versions.
Also, when this issue occurs, can you see anything on your device's console (adb logcat)?
Thanks, I've not heard of Crosswalk before and looks to be a good idea! It seems to be available via PhoneGap Build so I've added it (v1.3.0). I've still got a bit of playing around to do - it doesn't seem to like having CSS styling applied, or work at all with remote videos - but I've got it working for my current main use case.
Seems a bit bloaty unfortunately, my tiny test app went from 3MB to 60MB, just by adding Crosswalk! But if it works then I can deal with that. :-)