0

I download my files with:

var fileTransfer = new FileTransfer();
fileTransfer.download(
  url,
  target,
  ..
);

And then i open them later with:

window.open(targetUrl, '_blank', 'location=no');

It works for PDF, XLX, DOCX etc. but not for AVI or MP4. It opens the Video Player with a Play Button and a 'loading..' Text. If i try to open the AVI or MP4 directly it plays the files just fine.

What am I doing wrong? Thanks!

Edit: I use a iPad Edit2: The Error: webView:didFailLoadWithError - 204: Plug-in handled load

Jonas
  • 2,139
  • 17
  • 38

2 Answers2

0

Try something like this if you have HTML:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
</video>

Try something like this is you just have Javascript:

function addSourceToVideo(element, src, type) {
    var source = document.createElement('source');

    source.src = src;
    source.type = type;

    element.appendChild(source);
}

var video = document.createElement('video');

document.body.appendChild(video);

addSourceToVideo(video, targetUrl, 'video/mp4');

video.play();

Also, ensure that you have the inappbrowser plugin installed.

phonegap plugin add org.apache.cordova.inappbrowser

per: phonegap open link in browser

Community
  • 1
  • 1
Steve Kennedy
  • 5,312
  • 3
  • 26
  • 41
0

I found the solution to my question:

Streaming of Videos in the browser is supported and playing local files is not. A native plugin will do the trick

Jonas
  • 2,139
  • 17
  • 38