tag:blogger.com,1999:blog-72386855013225666.post4889999949695552571..comments2023-04-18T05:16:02.299-04:00Comments on Simon Mac Donald: Partial Support for the Video Tag in PhoneGap Android 2.2.0Simon MacDonaldhttp://www.blogger.com/profile/14749383583517044214noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-72386855013225666.post-71702097124560249512013-04-24T21:55:07.771-04:002013-04-24T21:55:07.771-04:00Rather strange. I might have gotten
confused by t...Rather strange. I might have gotten <br />confused by the HW / SW buttons. <br /><br />What I consider as back button is the one on right side of the Home (real) button (under the glass but not the screen) (Galaxy S3)<br /><br />I just tested with S3 and my app which is using the video plugin. Video does automatically play full screen, like in any other android device I have tested. Video player is the one that comes by default with S3.<br /><br />Yet, the back "button" stays visible, and lit as it still outside of the screen area. I hit it once, and the phone prompts me to hit again in order to close the video player.<br /><br />With Nexus 7, all the "buttons" are in the screen area, they still stay visible while the video is playing, and again hitting twice the back button, video player quits and I can continue using the application.<br /><br />Have I missed something obvious?Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-65733478567619368802013-04-23T10:45:37.075-04:002013-04-23T10:45:37.075-04:00@Petri
Well the HW back button was removed which...@Petri <br /><br />Well the HW back button was removed which may confuse some users. It all depends on how well the video player application UI is designed.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-1178460004082524532013-04-23T10:41:10.325-04:002013-04-23T10:41:10.325-04:00On all android devices, as far as I know, there is...On all android devices, as far as I know, there is a back button. <br /><br />You usually hit it twice in order to get out of the video app and back to the application the video was started from. That's how it seems to be working with my S2 and Nexus 7 as well as my friend's S3.Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-61078377682899373842013-04-22T22:37:45.489-04:002013-04-22T22:37:45.489-04:00@Hoxton Sax
There is no way to add a close butto...@Hoxton Sax <br /><br />There is no way to add a close button. I just fire off an intent to play the video and the default video player starts to play. It sounds like the video player on the S3 is typical Samsung bloatware that doesn't take into account the way Android works. There is a similar problem with the default voice recorder on Samsung devices as well. The only way to really fix this is to install another application that can play vidoes on the S3 and select that when the video is supposed to be played.<br /><br />I hate to sound beaten down but this is why I switched to Nexus devices as it keeps the carrier bloat ware off the phone.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-57816048615393388212013-04-22T16:57:03.229-04:002013-04-22T16:57:03.229-04:00Thanks for a brilliant plugin! I do have one prob...Thanks for a brilliant plugin! I do have one problem though ... using Phonegap 2.4 and JqueryMobile 1.3 and works perfectly on android tablets that I have tested on (including Mexus 7 and Samsung Tablet 10.1) - but on Samsung Galaxy S3 where video plays full screen by default, there is no back button or close button showing so I can not get the user to return to the app.<br /><br />The app content is an html video tag - (for iOS then this plays fine) but if the platform is Android then the src is used to play using the VideoPlayer plugin. For tablets then the device still shows the 'back' button allowing user to navigate back to the app during or after playing the video - but this is not visible on Samsung Galaxy S3. <br /><br />Is there a way to add a 'Close' button to the video player (or 'Back' button) in these cases ?<br /><br />Any help would be gratefully appreciated - and the VideoPlayer plugin has been a 'life saver' . . many thanks for sharing it !Hoxton Saxhttps://www.blogger.com/profile/03401722087453728486noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-33688683940577245562013-03-19T08:58:56.430-04:002013-03-19T08:58:56.430-04:00@neil briscombe
Check out the code starting from ...@neil briscombe<br /><br />Check out the code starting from line 80 of the VideoPlayer plugin for an example.<br /><br />https://github.com/macdonst/VideoPlayer/blob/master/2.2.0/src/com/phonegap/plugins/video/VideoPlayer.javaSimon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-7297589897912578792013-03-19T04:57:04.890-04:002013-03-19T04:57:04.890-04:00Hi Simon,
Thanks for all the help and advice you ...Hi Simon,<br /><br />Thanks for all the help and advice you give to everyone. The idea of copying out of the application's package and on to the file system struck me too as a work around.<br /><br />I think it would be a great if could post a code example code.<br /><br />Kind regards,<br /><br />Neil Briscombe.<br />Anonymoushttps://www.blogger.com/profile/09338695033977179543noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-68486405693534439972013-03-03T23:40:08.660-05:002013-03-03T23:40:08.660-05:00@R.J. Steinert
You could try opening an issue but...@R.J. Steinert<br /><br />You could try opening an issue but there are many bugs open against the video tag. You're not going to see traction on any of them on Android 4.x or later.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-42533635739453399522013-03-01T03:33:03.931-05:002013-03-01T03:33:03.931-05:00@ Simon MacDonald Thank you so much for your help...@ Simon MacDonald Thank you so much for your help on this. I get the feeling that the limitation of not being able to reference a video as a relative link may have been something that was overlooked by the Android team. Would that be a fair guess from what you know? I'm thinking about filing a bug report (https://code.google.com/p/android/issues/).Anonymoushttps://www.blogger.com/profile/12303132093676535160noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-66356493738949405142013-02-28T11:50:36.271-05:002013-02-28T11:50:36.271-05:00@R.J. Steinert
No, there is no way to load the fi...@R.J. Steinert<br /><br />No, there is no way to load the files from the APK. I make mention to that in the post. Yeah, you could check for first run and copy the videos to internal or sdcard to be played.<br /><br />Investigations are being done on our side to be able to run a ChromeWebView but it still adds 11mb to the app and it's pretty buggy. Talks with google developer advocates have intimated they are working on a ChromeWebView but nothing promised.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-68156912957745362282013-02-28T11:45:01.111-05:002013-02-28T11:45:01.111-05:00Woohoo! Loading from file:///mnt/sdcard/external_s...Woohoo! Loading from file:///mnt/sdcard/external_sd does the trick. <br /><br />https://github.com/rjsteinert/HTML5VideoInAndroidWebViewExample/commit/3f7ffb9cca9656cd4286d490e348960e37126c09#L0L9<br /><br />Is there any way to load files from the APK itself? In order to make the example a self contained thing we would at the moment have to write an install script that puts that test.m4v file on your SD Card. That would be a really ugly solution. <br /><br />Lastly, the fact that the WebView won't let the source of a video file be relative to the page being viewed is absolutely a shame. Does anyone have any idea when Google is going to drop using Android Browser for WebView in favor of Google Chrome or at least start putting some elbow grease into the existing WebView?Anonymoushttps://www.blogger.com/profile/12303132093676535160noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-66350454106980992912013-02-28T11:26:03.896-05:002013-02-28T11:26:03.896-05:00@Simon Mac Donal Thank your for the suggestion. I ...@Simon Mac Donal Thank your for the suggestion. I just changed the path to your suggestion and pushed the change to GitHub but still no luck after pushing to an Android device. My guess is that it's not an encoding problem because the same file I'm testing locally (in the repository) is the same file that does work when referenced remotely in the loadRemoteFileFromHTTP branch. Anonymoushttps://www.blogger.com/profile/12303132093676535160noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-38323335685187205282013-02-28T11:09:02.224-05:002013-02-28T11:09:02.224-05:00@R.J. Steinert
Oh, except I'm an idiot as it ...@R.J. Steinert<br /><br />Oh, except I'm an idiot as it can't read from the Android assets directory. You'll need to copy that file somewhere on the SD card like /mnt/sdcard or load it from a remote http server.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-42639438137423393752013-02-28T11:07:38.961-05:002013-02-28T11:07:38.961-05:00@R.J. Steinert
Based upon your github repo you sh...@R.J. Steinert<br /><br />Based upon your github repo you should be using the url file:///android_asset/www/test.m4v to load the video. The next problem you may run into is that the video file codec is not supported.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-45792064900185075462013-02-28T10:47:40.174-05:002013-02-28T10:47:40.174-05:00I have been successful at getting an example of lo...I have been successful at getting an example of loading a remote video via HTTP but I have had not luck loading a video file on the Android itself. Part of the problem could be me not understanding how the file:/// protocol resolves to the file system. I tried changing the src attribute in my example to file:///test.m4v and then placing test.m4v in almost every directory on my Android device AND every directory in the APK but still no luck. <br /><br />My example repository is quite simple, would anyone care to fork it in an attempt to show the world that Android can play a video file on an Android device in a WebView? <br /><br />https://github.com/rjsteinert/HTML5VideoInAndroidWebViewExample/blob/loadLocalFileUsingFileReader/assets/www/index.htmlAnonymoushttps://www.blogger.com/profile/12303132093676535160noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-24898998636494490692012-12-27T15:14:42.073-05:002012-12-27T15:14:42.073-05:00@Simon,
Yes. Everything is working as expected no...@Simon,<br /><br />Yes. Everything is working as expected now. Thank you.<br /><br />I implemented the easy fix which was to lower the target platform from 17 to 16, as indicated in the group post. Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-49471650844258292332012-12-27T14:54:41.983-05:002012-12-27T14:54:41.983-05:00@Petri
So you are good now?@Petri <br /><br />So you are good now?Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-27128791445536020382012-12-27T14:50:01.941-05:002012-12-27T14:50:01.941-05:00Just found the info for the problem of "devic...Just found the info for the problem of "deviceready" not firing on 4.2.1. here. (https://groups.google.com/forum/?fromgroups=#!topic/phonegap/MDYdSSE9ALA)Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-2102330659959546422012-12-27T14:37:34.408-05:002012-12-27T14:37:34.408-05:00@Simon, thanks for your reply.
Indeed it seems li...@Simon, thanks for your reply.<br /><br />Indeed it seems like other PhoneGap commands are not working either. (I had to create a network check in order to determine this.)<br /><br />As a matter of fact, the entire deviceready is not fired.<br /><br />Yet the exact same code works with older Android systems, which makes me wonder what needs to be done differently with 4.2.1, in order to get the PhoneGap stuff loaded up. <br /><br />So far my search for that has been fruitless.Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-19665967835632589332012-12-27T11:26:40.387-05:002012-12-27T11:26:40.387-05:00@Petri
If you can't find "exec" th...@Petri <br /><br />If you can't find "exec" then it doesn't sound like PhoneGap has loaded yet. Do other PhoneGap commands work at this point?<br /><br />The files in /android_asset/www don't actually exist on the file system. They are part of your application bundle.Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-31136382770408075862012-12-25T00:25:14.459-05:002012-12-25T00:25:14.459-05:00Simon, thanks for the good work....
However, I...Simon, thanks for the good work....<br /><br />However, I'm having some problems with Nexus 7 (4.2.1), playing local videos.<br /><br />I understand the videos from asset folder are not supported by the latest PhoneGap 2.2.0. Therefore I have implemented a condition which will use the video.js plugin instead. Video.js plugin works fine with 2.2.2 and 4.0.4 devices, but not with 4.2.1.<br /><br />I'm getting an error:<br />ERR Playing: file:///android_asset/www/media/la-test-02.mp4<br />ERR Error: TypeError: Object [object Object] has no method 'exec'<br /><br />my code:<br /> try {<br /> console.log("Playing: " + path);<br /> window.plugins.videoPlayer.play(path);<br /> } catch (e) {<br /> console.log("ERR Playing: " + path);<br /> console.log("ERR Error: " + e);<br /> }<br /><br />You mentioned in previous reply, "should be able to load things off the file system or via http"<br /><br />I would like to try the file system route, but so far had no luck of locating the "file:///android_asset/www/media/la-test-02.mp4" file via file system. I tried using this example: http://docs.phonegap.com/en/2.2.0/cordova_file_file.md.html#FileReader<br /><br />Any pointers would be appreciated with either solving the "exec" problem or locating the local file via file system.Petrihttps://www.blogger.com/profile/01361853168866786613noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-87486912794038271132012-12-24T12:19:22.048-05:002012-12-24T12:19:22.048-05:00@James
Well if you are using Android 4.x then you...@James<br /><br />Well if you are using Android 4.x then you aren't using our shim which<br />is only needed in earlier versions of Android. If you have hardware<br />acceleration turned on correctly then the video tag should work. You<br />won't be able to play things out of the assets directory but you<br />should be able to load things off the file system or via http.<br /><br />What does your html look like?Simon MacDonaldhttps://www.blogger.com/profile/14749383583517044214noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-1908769778520863702012-12-17T06:17:29.932-05:002012-12-17T06:17:29.932-05:00Hi,
This is a good start!
Unfortunatly I need a co...Hi,<br />This is a good start!<br />Unfortunatly I need a couple of more things in order for it to work on my app.. So i am back to the Well trusted Plugin..<br /><br />If you what feedback on it let me know<br /><br />Keep up the brilliant work<br />Thanks<br />KimAnonymoushttps://www.blogger.com/profile/15559285931648707380noreply@blogger.comtag:blogger.com,1999:blog-72386855013225666.post-9398306871309832932012-12-11T14:21:07.242-05:002012-12-11T14:21:07.242-05:00Thanks for the helpful post.
I am still strugglin...Thanks for the helpful post.<br /><br />I am still struggling to get the video tag to play in my android app. I don't want to use the video plugin as it takes you out of the app and interrupts the user experience. <br /><br />I have a phonegap project set up in eclipse using cordova 2.2.0 <br /><br />It extends DroidGap.<br /><br />I am targeting Android 4.0+.<br /><br />I have tested on several tablets including the Nexus 10 running 4.2<br /><br />I have turned on hardware acceleration in the AndroidManifest.xml<br /><br />Is there a way to test if the hardware acceleration is enabled through phonegap? Can we access: View.isHardwareAccelerated()<br /><br />My poster image loads if I do this:<br /><br />var video = document.getElementById('testVideo')<br />video.poster="cover.jpg";<br /><br />But if I set the source:<br /><br />video.src = "test.mp4";<br /><br />I just get a loading video symbol and nothing appears not even the poster image.<br /><br />I have tried multiple codecs. All play via the browser on the tablet and all play via your video plugin but not via the video tag.<br /><br />I have also tried loading a video from the internet but get the same problem.<br /><br />I am really stumped by this and would really appreciate any advice you can offer.<br /><br />Have you managed to get this to work in a phonegap app?<br /><br />Is it possible to upload an example?<br /><br />Thanks in advance.<br />JamesAnonymousnoreply@blogger.com