Simon Cozens
Simon Cozens

Reputation: 765

Cordova Android local video playback used to work; now doesn't

I have a Cordova application which downloads a video file to local storage and then plays it using a HTML <video> tag. This worked fine on iOS and Android up on Cordova version 3.7.1. I recently updated Cordova to the latest version (6.3.1) and now the video doesn't play on Android. iOS is working fine.

The video file is saved to file:///storage/emulated/0/Android/data/org.my.package/foobar.mp4; using ADB, I can see the file is being correctly saved (using FileTransfer) to that location. File size is correct, and permissions are user and group readable.

The video doesn't seem to load at all; v.src is empty, and v.duration is NaN, and v.networkState is 3 (NETWORK_NO_SOURCE)

The video element is

<video id="video" playsinline="1" webkit-plays-inline="1" poster preload="metadata">
    <source id="source" type="video/mp4" 
      src="file:///storage/emulated/0/Android/data/org.my.package/foobar.mp4">
</video>

I haven't changed the HTML or the Javascript since upgrading Cordova to 6.3.1.

Upvotes: 2

Views: 541

Answers (1)

Simon Cozens
Simon Cozens

Reputation: 765

(Previous wrong answer removed.)

I think the problem was actually the Crosswalk plugin. Adding or removing the plugin doesn't take effect until you remove the platform and add it again, so I didn't suspect that.

Specifically, I had turned on the Crosswork option --enable-unified-media-pipeline to try to help me with a different issue (ability to set the video playback speed). Removing that option makes it work again. This is counter-intuitive because you're often recommended to turn that option on to fix video issues.

Upvotes: 1

Related Questions