Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-6051

video / audio won't play from cdvfile:// urls




      We have an application that used to work in Cordova 2.9, we think we have traced down the error to cdvfile://. Here's what's happening:

      The Application

      We're loading a few videos and a HTML-File referencing those videos into the app, using FileTransfer. This transfer is fine now, and we can access and display the HTML-File and other assets like images. The videos on this page however won't play. They display as "broken" (strike-through play symbol on iOS). We know the videos to run, it's not the video's encoding, we also triple-checked all the filenames as well. If we pre-package the video into the app, the same setup does play just fine.

      Behaviour Cordova 2.9

      We're getting the just-downloaded html file from the filesystem and call toURL() on that entry. In 2.9 this will return a lengthy (but working) file:///-url. We're basically setting

      window.location = entry.toURL(); // returns file:///...

      Behaviour Cordova 3.3

      When calling toURL, we're now getting a cdvfile:// URL, and (since the video file is referenced relatively) the video is also loaded from a cdvfile:// URL.

      Why i believe the cdvfile:// to be at fault

      Basically "it used to work". We're suspecting that the file-protocol emulates a lot of the iOS-y stuff when it comes to video. Possibly the Content-Type-Header and the Range-Header that iOS uses extensively for streaming the video from a webserver.

      For an audio file, we're getting log-lines reading "_itemFailedToPlayToEnd:

      {kind = 1; new = 2; old = 0;}


      I did not find any way to get a file:///-URL out of cordova 3.3, but i am pretty sure that this would cure my immediate problem.


        Issue Links



              iclelland Ian Clelland
              amenthes Claudius Coenen
              2 Vote for this issue
              6 Start watching this issue