Discussion Forums  >  Audio, Video, Playing, Recording

Replies: 9    Views: 188

EDSE447
Apple Fan
Profile
Posts: 3
Reg: Nov 11, 2012
Edmonton
5,330
11/15/12 10:10 PM (11 years ago)

YouTube Videos

Hi there, I've read the threads about the "wheel of death" and applied the relevant fix, but I still can't get any YouTube videos to play when adding them as custom URLs and/or links in HTML5 and running in Android. I can get to the YouTube page, but then the video is just black. There are threads about this, but none of them seem to be resolved. Was this ever fixed? I have an app with about 30 videos in it and I really don't want to have to go through all of the effort to resturcture everything. Thanks for any help anyone can offer!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/16/12 02:51 AM (11 years ago)
What kind of device? What does you HTML5 look like, is it valid (use a validator) What Android version are you targeting. Some Android devices simply don't play videos when HTML5 is embedded in a WebView widget in an app. This is the widget that all the HTML content in our app uses. It's a major pain point for all Android folks these days...sigh. Does the LogCat console give any clues? Tons and tons of these things are "in the wild" and most of them play video just fine. But, there are for sure a bunch of gadgets that don't (like any simulator).
 
AlmaR
Lost but trying
Profile
Posts: 73
Reg: Jun 13, 2011
location unknow...
5,630
like
11/16/12 07:38 AM (11 years ago)
Hi David! Just one question, does the "Wheel of Death" fix - comment out //showProgress(null, null); on BT_screen_customHTML.java (line 132) and BT_screen_customURL.java (line 133) in my case is 132 (//showProgress(null, null);) - work on the simulators? Because I have applied it but it didnt work for me but I only tested it on the simulator not in a real device (coz I dont have one). Looking forward to your answer!
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/16/12 12:11 PM (11 years ago)
It's super super hard to know how the dozens of different simulators are behaving. It's one of the toughest part of Android dev...the devices are almost NEVER the same behavior. This means it's also tough to know if commenting out the showProgress() call will do what you want. Some ideas: The only thing the showProgress() method call does it turn on the "loading" graphic. Nothing more. The idea is that when the screen first loads, it should show "loading" and when the URL / Content is done loading in the WebView, it should hide the "loading" message. This is the challenge. Because not all the devices or simulators are telling your app "hey, I"m done loading now" the hideProgress() never gets called. This is what the fix is all about. To prevent the loading graphic from showing all together, on any device, simply comment out every occurrence of the showProgress() call. Comment them out, loading graphic won't show - ever.
 
AlmaR
Lost but trying
Profile
Posts: 73
Reg: Jun 13, 2011
location unknow...
5,630
like
11/16/12 12:39 PM (11 years ago)
Thanks David! First of all I will test my app on a real device and if it does the Wheel of Death I will try commenting out every occurrence of the showProgress() call. Will keep you posted.
 
AlmaR
Lost but trying
Profile
Posts: 73
Reg: Jun 13, 2011
location unknow...
5,630
like
12/05/12 05:09 AM (11 years ago)
Hi David! Thanks for you help. I finally get rid of the Wheel of Death by commenting out all the showProgress() in BT_screen_customURL.java & BT_screen_customHTML.java but I'm still not able to watch the videos. The video shows up but once you click it it does nothing or turn black. I made a new app (BT 2.0) just for the purpose of testing youtube videos on Android. I tested it on different emulators and hardward (Samsung Galaxy 5 and Galaxy S II) with a tab and non-tab layout and the following screens: Custom HTML with a link to youtube Custom HTML with a video embedded (iframe) Custom HTML with a video embedded with the old code Custom URL with a link to youtube Custom URL with a video embedded (iframe) Custom URL with a video embedded with the old code Launch Native App The only one that work was the "Launch Native App" screen but unfortunately it is not suitable for my project. This is what the logcat says when I tested it on the Custom HTML with a video embedded (iframe) on the emulator: 12-05 08:29:27.278: D/dalvikvm(306): GC_FOR_MALLOC freed 6608 objects / 588352 bytes in 77ms 12-05 08:29:27.708: I/global(306): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required. 12-05 08:29:27.718: W/ZZ(306): BT_screen_menuListSimple:handleReportToCloudResults appLastModifiedOnServer (value on server): Wed, 05 Dec 2012 10:39:53 -0800 12-05 08:29:27.718: W/ZZ(306): BT_fileManager: readTextFileFromCache: "appModified.txt" 12-05 08:29:27.718: W/ZZ(306): BT_screen_menuListSimple:handleReportToCloudResults previousModified (value on device): Wed, 05 Dec 2012 10:39:53 -0800 12-05 08:29:27.718: W/ZZ(306): BT_fileManager: saveTextFileToCache: appModified.txt 12-05 08:29:27.849: W/ZZ(306): BT_screen_menuListSimple:handleReportToCloudResults server data not changed, no refresh needed 12-05 08:29:30.348: W/ZZ(306): BT_screen_menuListSimple:handleItemTap loads screen with itemId: "B02CF7B1546F4A104098B82" 12-05 08:29:30.348: W/ZZ(306): BT_application:getScreenDataByItemId with itemId: = "B02CF7B1546F4A104098B82" 12-05 08:29:30.348: W/ZZ(306): BT_application:getScreenDataByItemId with itemType: "BT_screen_customHTML" with nickname: "Custom HTML Embed" 12-05 08:29:30.388: W/ZZ(306): BT_act_controller:loadScreenObject for screen with itemId: "B02CF7B1546F4A104098B82" and itemNickname: "Custom HTML Embed" and itemType: "BT_screen_customHTML" 12-05 08:29:30.528: W/ZZ(306): BT_screen_menuListSimple:onPause (BASE CLASS) 12-05 08:29:30.588: W/ZZ(306): BT_activity_base:onCreate (BASE CLASS) 12-05 08:29:30.608: W/ZZ(306): BT_screen_customHTML:onCreate 12-05 08:29:30.608: W/ZZ(306): BT_viewUtilities:updateBackgroundColorsForScreen with nickname: "Custom HTML Embed" 12-05 08:29:30.608: W/ZZ(306): BT_viewUtilities:updateBackgroundColorsForScreen: setting background color to: "#FFFFFF" 12-05 08:29:30.618: W/ZZ(306): BT_viewUtilities:getNavBarForScreen building nav. bar for screen with nickname: "Custom HTML Embed" 12-05 08:29:30.628: W/ZZ(306): BT_screen_customHTML:backgroundWorkerThread this screen does not use a background image 12-05 08:29:30.678: W/ZZ(306): BT_screen_customHTML: loading from cache: B02CF7B1546F4A104098B82_screenData.html 12-05 08:29:30.678: W/ZZ(306): BT_fileManager: readTextFileFromCache: "B02CF7B1546F4A104098B82_screenData.html" 12-05 08:29:30.688: W/ZZ(306): BT_screen_customHTML: loadDataString 12-05 08:29:30.698: W/ZZ(306): BT_screen_customHTML:onStart (BASE CLASS) 12-05 08:29:30.698: W/ZZ(306): BT_screen_customHTML: start GPS is set to NO in the applications configuration data, not starting GPS 12-05 08:29:30.698: W/ZZ(306): BT_screen_customHTML:onResume (BASE CLASS) 12-05 08:29:31.168: W/ZZ(306): BT_screen_menuListSimple:onStop (BASE CLASS) 12-05 08:29:31.398: W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture 12-05 08:29:35.968: W/ZZ(306): BT_screen_customHTML:onPageFinished finished Loading: about:blank 12-05 08:29:35.998: W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture 12-05 08:29:37.268: W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture 12-05 08:29:37.358: W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture 12-05 08:29:37.408: W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture And keeps repeting W/ZZ(306): BT_screen_customHTML:MyPictureListener: onNewPicture Any ideas? I saw that lots of people have my same problem. Do youtube videos actually work on Android when you call them from a HTML screen?
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
12/11/12 05:12 AM (11 years ago)
Would love a solution on this too! Really need the iframe sorted out on Android, cant believe it doesnt work.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
12/11/12 12:47 PM (11 years ago)
Tons and tons of testing on this...Android simply will not behave the same way across multiple devices when using an iFrame to host video in HTML. iFrames are a complicated and have been for many years. As disappointing as this is, it doesn't surprise me at all that Android can't handle this configuration. We get frustrated because the behavior is so different depending on the device you're working with. Not sure what the best solution is for your app, it depends on tons of other factors: See this: http://stackoverflow.com/questions/9036415/android-webview-cannot-render-youtube-video-embedded-via-iframe
 
LeonG
Apple Fan
Profile
Posts: 694
Reg: Nov 08, 2011
Hamburg
17,740
like
12/11/12 02:20 PM (11 years ago)
So funny as Google owns Youtube and Android and can´t connect them..... Think we will have to wait then if even David does not have a solution.
 
AlmaR
Lost but trying
Profile
Posts: 73
Reg: Jun 13, 2011
location unknow...
5,630
like
03/01/13 02:52 PM (11 years ago)
Below is a workaround from @perrytheweaver: In the Eclipse BZ project force html links to load in mobile phone's native browser: /src/com/nameofyourprogramapp/BT_act_controller.java canLoadDocumentInWebView() Add a file type (or url snippet) to: doNotLoadList.add("youtube.com"); doNotLoadList.add("youtu.be"); https://www.buzztouch.com/forum/thread.php?tid=2AA2085F8EE542275D3CADB&fid=5FE1FB2355A48AD674A6CA3&sortColumn=FT.id&sortUpDown=DESC&currentPage=1
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.