1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default


    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:

    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();
    			}
    		}
    	}
    });
    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.

    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.

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    7
    Vote Rating
    0
    Bukurov Alex is on a distinguished road

      0  

    Default


    Quote Originally Posted by matfin View Post
    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.
    How did you do it?

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    393
    Answers
    14
    Vote Rating
    16
    digeridoopoo will become famous soon enough

      0  

    Default 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

    :-)

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."