Html5Video icon indicating copy to clipboard operation
Html5Video copied to clipboard

Video tag doesn't get updated

Open swigle opened this issue 10 years ago • 8 comments

Hi,

I've tried to implement your plugin. I'm testing on a Galaxy S4 with the 4.4.2 update. I'm using sencha with phonegap. Added the plugin with cordova plugin add. I've tried to recreate your example as best i can.

  • Added my video's to the res/raw folder
  • added a video tag like so < video id="video" loop >< /video >
  • call window.plugins.html5Video.initialize({ "video" : 'myvideo.mp4' });
  • and when the video should play, i call window.plugins.html5Video.play("video", function(){me.gotoEndPage();});

In logcat i see that the plugin is being called. No errors are thrown. Typical output: 03-19 13:49:25.120: D/Html5Video(5337): Id: video , src: android.resource://com.swigle.Ankle/2130968576 03-19 13:49:51.305: D/Html5Video(5337): Playing video with id: video

but all i get is a great grey block with a stretched video player which doesn't do anything.

After i call the initialize function, i alert the outerHTML of the video tag, and this is still completely empty. Should this not contain the video now?

any idea's on what goes wrong?

btw: hardware accelerated is set to true, using cordova 3.3

thnx

swigle avatar Mar 19 '14 12:03 swigle

This plugin does not currently work on Android 4.4. They changed the webview implementation on 4.4 and I havn't had a chance to look more into it. It might not be possible anymore since I think the new webview doesn't support hardware acceleration atm

jaeger25 avatar Mar 22 '14 21:03 jaeger25

Thanks for your reply!

So baically, i'm screwed... :) I understand this is because of the 4.4 update and all the changes google made to it's chromium webview, but any chance this will be fixed anytime soon? With either a fix or a workaround?

swigle avatar Mar 24 '14 08:03 swigle

Hi @jaeger25

Any updates or fixes for this?

imduffy15 avatar Apr 08 '14 19:04 imduffy15

This issue on Apache's official Jira tracker sheds a little more light on the subject, but I'm afraid that it doesn't bring much good news... https://issues.apache.org/jira/browse/CB-6079

qbahamutp avatar May 09 '14 09:05 qbahamutp

I've since fixed these problems by using an altered version of a different plugin. Basically what i did was when opening the page i use a plugin which copies the needed video from my assets dir to the SDCard @ android/data/< appname >/files. Then i set the url of the video to the correct path gotten with the files plugin of cordova and everything works. But i did have to add an ugly check on android version to get it to work in all android versions.

swigle avatar May 09 '14 09:05 swigle

@swigle Can you fork this repo and share your changes? :)

imduffy15 avatar May 09 '14 15:05 imduffy15

We didn't actually use this repo in the end so there's nothing to fork. As stated above, we used a different plugin to fix our issues. The problem was not the videotag not being updated properly but android 4.4 that is not allowed to read media files from the assets dir. So what we did to get video's working is to copy all the video's from the assets dir with an altered version of another plugin that copies the video's to the SD card. Then we set the SRC of the videotag to the correct url on the SDcard and everything works fine, without this HTML5video plugin.

swigle avatar May 12 '14 07:05 swigle

If anyone is still having problems with playing video on KitKat, I've got a solution, which is quite similar to Swigles.

If you include your file in your www folder, you can download it and save it to the local file system, using the FileTransfer plugin for Cordova (see http://www.raymondcamden.com/2014/7/1/Cordova-Sample-Check-for-a-file-and-download-if-it-isnt-there for details) , using the relative URL of the file as the source. Once the file has been downloaded, you can just set the source attribute to the url (which in this example in the previous link, would be store + fileName)

Note 1 - the reference link above is quite good in it downloads the file only once, so it won't be copied again, and will instead ignore the file download.

Note 2 - if you want to make sure the video autoloads, follow the great advice here http://blog.blairvanderhoof.com/post/78586868260/getting-the-html5-video-tag-to-work-in-cordova-for in the first gist, and add "autoplay" into the

Hope it helps! If anyone has any trouble, feel free to get in touch and will talk them through it.

tobeee avatar Sep 09 '14 17:09 tobeee