Discussion Forums  >  Uncategorized

Replies: 14    Views: 795

JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
11/23/11 02:17 AM (12 years ago)

Android 1.5, YouTube Iframe HTML5 Embed

Hi I am working on an app which embeds youtube API resulted videos in Iframe embed. This does not seems to play in when embeded in app, but the same custom url page works well in android browser (I tried with Android 2.2, 2.3 and 3.2, all in devices). Is somebody have this issue, I can't seem to find any error in Logcat... I am struk. can somebody help me please... Thanks JR
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/23/11 09:24 AM (12 years ago)
Good question. Not sure what you're asking here. If the same HTML loads when you use a Custom URL, it should also load if you use Custom HTML (nearly the same but not exactly). However, android does strange things sometimes to it may take a little sluething out.
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/23/11 03:50 PM (12 years ago)
Hi David, Thanks for your response. This is not Custom HTML Vs Custom URL issue. For example if I open this webpage http://goo.gl/JG9rG in Android browser, the youtube video plays fine, whereas when youthe same as my webpage for Custom URL in my app (v1.5) it doesn't play the video. do you have any thoughts, I am not able catch any error in logcat... Thanks JR
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/28/11 10:31 AM (12 years ago)
Can Somebody please shed some light... on this issue... Thanks JR
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/28/11 11:40 AM (12 years ago)
Lost track of this over the weekend. So... The type of screen you are creating in the app ( Custom URL or Custom HTML / Text ) will determine which .java class file is not behaving the way we expect. Both of these screen types use an Android built in WebView but they do operate a bit different. Close, not the same. It's a matter of figuring out what the WebView is loading, or, more importantly, what it's not loading them debugging. I'm happy to assist with this just need to know the setup. If you're pasting HTML in a Custom HTML screen, maybe send a .txt file to info 'at' buzztouch.com with what you're pasting. If you're using a custom URL, post the URL
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/28/11 01:09 PM (12 years ago)
Hi David, This is Custom URL (http://goo.gl/JG9rG). If I open this URL in Android browser, the embedded youtube video plays fine, whereas when the same URL is used as webpage for Custom URL in my app (v1.5) it doesn't start/play the video. I see this behavior in Android devices (2.2, 2.3 and 3.2) as well as emulators. Please help. Thanks JR
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/29/11 10:36 AM (12 years ago)
Hi David, Just to follow up... Is there any suggestion for this issue?? Thanks JR
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/29/11 12:16 PM (12 years ago)
OK, I got this to work on a simulator and a device. A few things... a) You are not pointing to an HTML page, you are pointing to a redirect script that eventually lands you at the .html page. This is generally OK but the built in Android browser does do some funky thing sometimes when it's redirected. Seems fine in this case. b) The 'loading' indicator on the screen never went away when I first tested it. I created a Custom URL screen and compiled / ran in the device and the video showed in the background but the loading indicator never dissappeared. If this doesn't dissappear nothing will work. The UI is locked up when this is showing so it needs to understand when to go away. c) I commented out line 137 in BT_screen_webView.java (in the /src folder) so the showProgress() method didn't trigger. Line 137 looks like this in my project: //showProgress(null, null); If you do the same it should work. The idea is that the WebView fires a 'did finish loading' message when it's done and thats when the loading graphic goes away. For whatever reason, this 'did finish loading' message isn't happening so the graphic never goes away, causing the issue. I'll be it's related to the way the iFrame is loading the content. Lots of stuff loading for sure. Uncomment that line, see if it works - does here ;-)
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/30/11 09:07 AM (12 years ago)
Hi David, yes your suggestion in c) solves the loading indicator problem. but, after the page loaded, the iframe embed of youtube video in the page loaded is not playing. Whereas it is playing fine in Android Native Browser. See below the logcat details of both instances. can you suggest why youtube video is not playing in webview, when it is actually playable in browser. Basically, I understand, Android Browser fires Mediaplayer intent and launch the youtube video, whereas in webview the click of the video and the following activity is not triggered, I don't know why this happens. can you help me please. Android Browser: 11-29 22:30:11.267: DEBUG/SearchDialog(271): launching Intent { act=android.intent.action.VIEW dat=http://goo.gl/JG9rG flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } 11-29 22:30:11.305: INFO/SearchDialog(271): Starting (as ourselves) http://goo.gl/JG9rG#Intent;action=android.intent.action.VIEW;launchFlags=0x10000000;component=com.android.browser/.BrowserActivity;S.query=http%3A%2F%2Fgoo.gl%2FJG9rG;S.user_query=goo;end 11-29 22:30:11.344: INFO/ActivityManager(68): Starting activity: Intent { act=android.intent.action.VIEW dat=http://goo.gl/JG9rG flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) } 11-29 22:30:13.654: INFO/ActivityManager(68): Starting activity: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=http://pastehtml.com/view/bezwjlxxz.html cmp=com.android.browser/.BrowserActivity } 11-29 22:30:13.954: DEBUG/dalvikvm(271): GC_FOR_MALLOC freed 7021 objects / 659312 bytes in 236ms 11-29 22:30:16.624: DEBUG/dalvikvm(271): GC_FOR_MALLOC freed 2134 objects / 141816 bytes in 353ms 11-29 22:31:20.094: DEBUG/dalvikvm(271): GC_FOR_MALLOC freed 2766 objects / 336704 bytes in 156ms 11-29 22:31:23.324: DEBUG/MediaPlayer(271): Couldn't open file on client side, trying server side 11-29 22:31:23.704: INFO/StagefrightPlayer(34): setDataSource('http://o-o.preferred.dfw06s10.v3.lscache3.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Csource%2Cratebypass%2Ccp&fexp=904546%2C914011%2C913104%2C909800&itag=18&ip=99.0.0.0&signature=B186438DE062757CEEA083882BA2425076282B19.1C4679C2B56E689F0AFC0263FF75887934D1CCF6&sver=3&ratebypass=yes&source=youtube&expire=1322658000&key=yt1&ipbits=8&cp=U0hRR1ZQVl9FSkNOMV9OSlpBOnc2TElwZjNsc3lj&id=bb5ce01650b0f00c&ptk=googledevelopers&oid=f4HuxqySiHA&ptchn=GoogleDevelopers') 11-29 22:31:27.024: INFO/AwesomePlayer(34): calling prefetcher->prepare() 11-29 22:31:27.574: INFO/Prefetcher(34): [0x12708] cache below low water mark, filling cache. 11-29 22:31:28.304: INFO/AwesomePlayer(34): prefetcher is done preparing 11-29 22:31:28.374: DEBUG/MediaPlayer(271): getMetadata 11-29 22:31:28.598: DEBUG/AudioSink(34): bufferCount (4) is too small and increased to 12 11-29 22:31:32.126: WARN/AudioFlinger(34): write blocked for 81 msecs, 1 delayed writes, thread 0xb3f0 11-29 22:31:36.304: WARN/InputManagerService(68): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@450d60e8 11-29 22:31:43.604: WARN/AudioFlinger(34): write blocked for 77 msecs, 2 delayed writes, thread 0xb3f0 BT APP Webview: 11-29 22:32:52.134: WARN/ZZ(315): BT_application:getScreenDataByItemId screenType is BT_screen_webView for screen with nickname: Test 11-29 22:32:52.144: WARN/ZZ(315): BT_act_controller:loadScreenObject for screen with nickname Test and type BT_screen_webView 11-29 22:32:52.144: WARN/ZZ(315): BT_act_controller:canLoadDocumentInWebView http://goo.gl/JG9rG 11-29 22:32:52.163: INFO/ActivityManager(68): Starting activity: Intent { cmp=com.testyt/.BT_screen_webView } 11-29 22:32:52.587: WARN/ZZ(315): BT_screen_webView:onCreate 11-29 22:32:52.627: WARN/ZZ(315): BT_viewUtilities:updateBackgroundColorsForScreen with nickname: Test 11-29 22:32:52.627: WARN/ZZ(315): BT_viewUtilities:updateBackgroundColorsForScreen: setting background color to: #FFFFFF 11-29 22:32:52.635: WARN/ZZ(315): BT_viewUtilities:getNavBarForScreen building nav. bar for screen with nickname: Test 11-29 22:32:52.647: WARN/ZZ(315): BT_screen_webView:backgroundWorkerThread this screen does not use a background image 11-29 22:32:53.104: WARN/ZZ(315): BT_strings:getSaveAsFileNameFromURL from: http://goo.gl/JG9rG file name: JG9rG 11-29 22:32:53.104: WARN/ZZ(315): BT_fileManager:canCacheDocument JG9rG 11-29 22:32:53.104: WARN/ZZ(315): BT_screen_webView: cannot cache document, invalid file type for: JG9rG 11-29 22:32:53.104: WARN/ZZ(315): BT_screen_webView: file not found in cache or in assets...loading URL from: http://goo.gl/JG9rG 11-29 22:32:53.124: WARN/ZZ(315): BT_screen_webView: loadUrl 11-29 22:32:53.124: WARN/ZZ(315): BT_screen_webView: start GPS is set to NO in the applications configuration data, not starting GPS 11-29 22:32:53.884: INFO/ActivityManager(68): Displayed activity com.testyt/.BT_screen_webView: 1468 ms (total 1468 ms) 11-29 22:32:54.677: WARN/ZZ(315): BT_act_controller:canLoadDocumentInWebView http://pastehtml.com/view/bezwjlxxz.html 11-29 22:32:56.744: DEBUG/dalvikvm(315): GC_FOR_MALLOC freed 3308 objects / 289352 bytes in 195ms 11-29 22:33:10.034: DEBUG/dalvikvm(128): GC_EXPLICIT freed 361 objects / 18920 bytes in 4901ms 11-29 22:33:10.374: DEBUG/dalvikvm(315): GC_FOR_MALLOC freed 1563 objects / 373880 bytes in 193ms 11-29 22:33:11.544: WARN/ZZ(315): BT_screen_webView:onPageFinished finished Loading: http://pastehtml.com/view/bezwjlxxz.html
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/30/11 11:16 AM (12 years ago)
'Android Browser fires Mediaplayer intent and launch the youtube video' That's exactly the difference. The built-in Android Browser is NOT playing the video, the new MediaPlayer intent is. When you load a CustomURL screen, you are loading an Activity that includes a built in WebView. This WebView does not understand how to launch a MediaPlayer intent 'automagically.' This tells me that the built in Android Browser (which is a sophisticated application in iteself) does understand how to do this. Because it's a stand alone application, I'm sure it's developers went through great pains to 'inspect' the content it loaded to do things like launch a Media Player or other Activitites based on the content that was loaded. This makes perfect sense. If I was to create an application who's primary purpose was to navigate web content, I too would probably build in logic to inspect the content after it loaded. The Custom URL screen is a simple Android Activity that includes a WebView. This WebView is relatively 'dumb' and does do much other than load the HTML then display it. Maybe hacking through it to get it 'understand' more about the content it loaded then make a decision based on that (like launch a MediaPlayer) is the wrong approach to take. Why not just launch a MediaPlayer intent in the first place (since you know the content is media). I'm not sure what the best approach is but will consider this throughout the day. I'll try to come up with solution and post later.
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
11/30/11 02:23 PM (12 years ago)
Hi David Thanks for heads up, I will wait for your suggestions, meantime I saw this (http://stackoverflow.com/questions/3815090/webview-and-html5-video), will this be helpful in this case? Thanks JR
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
12/01/11 02:59 PM (12 years ago)
Hi David, do you have any updates/suggestions on this issue? Thanks JR
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
12/02/11 11:35 AM (12 years ago)
Can Somebody please shed some light... on this issue... Thanks JR
 
JayArr
I hate code!
Profile
Posts: 17
Reg: Jan 19, 2011
USA
170
like
12/05/11 01:59 PM (12 years ago)
Hi David, do you have any updates/suggestions on this issue? Thanks JR
 
MobiGeni
Aspiring developer
Profile
Posts: 65
Reg: Jan 09, 2013
Akersloot
1,350
like
02/15/13 04:42 AM (11 years ago)
Yes, stuck on this too, any suggestions on this issue? Thanks Vidal
 

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.