1

I am trying to create an Adobe AIR that plays a YouTube video. However, I have the usual problems mentioned when using StageWebView:

If I use hardware acceleration, the video appears strangely. If I don't the initial video thumbnail appears but only the sound is played presenting a black screen, until I toggle fullscreen.

There is a variety of issues I want to ask, since I find it really hard to find a clear answer on how to simply add a youtube video inside the Adobe AIR app for Android.

  1. Is there any clear answer/tutorial presenting the implementation of Chromeless Youtube player on an Adobe AIR for Android?
  2. Is there any way to embed a YouTube video without it looking flipped or causing black screen and crashes on the app with StageWebView?
  3. Is it possible to use HTMLLoader to embed the YouTube video in the Adobe AIR app using JavaScript and if yes, is there any tutorial?

I think that this is an issue that many people have and it's not clear. Thanks a lot.

George
  • 215
  • 3
  • 8
  • I did not tried this on mobile, but on desktop I load the youtube video using the SWFLoader or MovieClipSWFLoader , to find the video url I think I used the Embed options on youtube and found there the link I needed(in my case http://www.youtube.com/v/VFj_6nEmy9E?list=PLB7tfxKXNttJaGK6EySbfeSekTi9SiM1W ) Avoiding the htmlLoader is best option to get around browser issues I hope it works on mobile – simion314 Oct 13 '14 at 15:32

2 Answers2

0

[EDIT]The bad news is the app crashes when the user tries to go full screen [/EDIT] Good news - maybe. I get it to work using the stagewebview - but instead of loading an external page i use 'videoView.loadString'

var videoView : StageWebView = new StageWebView();
videoView.stage = Starling.current.nativeStage;
videoView.viewPort = new Rectangle( 100,  100, videoView.stage.stageWidth-200, videoView.stage.stageHeight-200);

var htmlString:String = "<!DOCTYPE HTML><html><body><iframe class=\"youtube-player\" style=\"border: 0; width: 100%; height: 100%; padding:0px; margin:0px\" id=\"ytplayer\" type=\"text/html\" src=\"http://www.youtube.com/embed/DQCji_PRaT8?fs=0\" frameborder=\"0\"></iframe></body></html>";
videoView.loadString( htmlString, "text/html" );

And also remember to set the <application android:hardwareAccelerated="true"> in the manifestadditions.

fideldonson
  • 581
  • 3
  • 15
0

In what I've found, just using the <application android:hardwareAccelerated="true"> seems to fix it. the iframe approach was irrelevant for me. Thanks fideldonson!