Skip to main content
Inspiring
July 9, 2012
Question

StageWebView YOUTUBE VIDEO

  • July 9, 2012
  • 1 reply
  • 688 views

I'm using StageWebView to watch a few YouTube videos.

Everything works great using Test Movie.

No problem in local situation but when I put the IPA on my device, I just get a white screen where the video should be.

Same thing if I load a simply URL as google for exemple...it's OK

It seems very simple yet I'm not finding anything on the web to help me out...

My code

<?xml version="1.0" encoding="utf-8"?>

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

                    xmlns:s="library://ns.adobe.com/flex/spark"

                    title="Player"

                    viewActivate="init()">

  <fx:Script>

                    <![CDATA[

                              import flash.net.navigateToURL;

                              import mx.events.FlexEvent;

                              import spark.events.ViewNavigatorEvent;

                              protected var webView:StageWebView = new StageWebView();

 

  protected function init():void

                              {

                                        var webView:StageWebView = new StageWebView();

                                        webView.stage = this.stage;

                                        webView.viewPort = new Rectangle( 0, 100, this.stage.stageWidth, this.stage.stageHeight/2 );

  //webView.loadURL( "http://www.google.com" );

                                        webView.loadURL("http://www.youtube.com/v/xQIeRGW1T5E?version=3");

                                        addEventListener(ViewNavigatorEvent.REMOVING, onRemove);

                              }

                              protected function onRemove(event:ViewNavigatorEvent):void{

                                        this.webView.dispose();

                              }

                    ]]>

  </fx:Script>

</s:View>

Thanks for your help, I'm work on this since many hours

Regards

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
July 9, 2012

It could be that the YouTube player that you're loading has ActionScript in it, which can work when doing an interpreter test movie, but won't work on an actual device. You want to try to get at the H.264 file that YouTube is using, and play that with net stream.