-
24 Apr 2012 1:03 PM #1
Unanswered: Embedding youtube videos that open in the native youtube player on Android
Unanswered: Embedding youtube videos that open in the native youtube player on Android
Hi Everyone,
I'm working on an app that has embedded videos and was wondering is there a way to embed youtube videos so that when they are tapped on, they exit out of the app and play the video in the native Android app installed on the phone?
I'm working with some fairly limited Android phones (The Samsung Galaxy Mini) and embedding the video using the iframe method doesn't work very well as the video won't play.
If anyone has successfully tried this and would care to share their wisdom I would be very grateful.
Thanks
Matt
-
26 Apr 2012 7:22 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,119
- Vote Rating
- 453
- Answers
- 3160
You can have an image of the video and on tap of it the browser should recognize it's a youtube video to open the youtube player.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
26 Apr 2012 7:31 AM #3
Hi,
Thanks for the reply. That solution works fine in iOS but unfortunately it was a bit of a nightmare to get it going in Android.
My approach was to take the youtube iframe approach as shown in the code below:
On the Android phones I was testing with, namely the Samsung Galaxy Mini and the Galaxy S2, the youtube video would skip straight to the end and not play at all.Code:Ext.define('Application.view.IosVideoPlayer', { extend: 'Ext.Panel', xtype: 'iosvideoplayerpanel', config: { fullscreen: true, scrollable: false, style: 'background-color: #fff;', tpl: '<h2>{title}</h2><iframe type="text/html" width="100%" height="30%" src="http://www.youtube.com/embed/{id}?controls=0&showinfo=0" frameborder="0"></iframe>', cls: 'videoplayer', listeners: { painted: function(){ button = Ext.ComponentQuery.query('#supportersbackbutton')[0]; button.go = {container: 'funstufflandingpanel', panel: 'behindthescenespanel'}; setTimeout(function(){button.show();}, 500); }, erased: function(){ button = Ext.ComponentQuery.query('#supportersbackbutton')[0]; button.hide(); } } } });
From working on solutions to this problem, even going as far as to embed some test videos into the view using the html5 video tag and Ext.video, nothing seemed to work on the Android devices.
When running this app in the Android browser as a web app, the videos displayed perfectly, but when compiling as a native android app the videos wouldn't play at all.
When updating to the latest version of the Sencha SDK tools and building a native Android app that way, I was able to get sound from the videos but no image.
In the end, we had to wrap the native Android app in Cordova and use an intent to catch taps on the video itself, which would then open them in the default android media player.
-
16 Aug 2012 2:31 AM #4
-
16 Aug 2012 3:47 AM #5
Oreilly?
Oreilly?
Doesn't the OReilly App already do this? It loads Youtube and when clicking opens the native player...haven't tested it on Android though
:-)


Reply With Quote