Skip to main content
sinious
Legend
October 23, 2013
Question

AIR for Android - StageWebView and Video (YouTube iFrame)

  • October 23, 2013
  • 5 replies
  • 9232 views

Hey all,

I've been converting an iOS tablet app over to Android and I've noticed the StageWebView has some curious limitations, especially with anything that accessed the GPU (video, etc).

At first the embedded YouTube (iframe) videos would just show the first frame of the video dutifully with the usual play button. When pressed, the video went black and all I heard was audio. The reason I even mention this is it took quite a while to locate this Adobe page with a section entitled "Enabling Flash Player and other plug-ins in a StageWebView object". So I added in the application tag to enable the plugins with acceleration (<application android:hardwareAccelerated="true"/>) and now I can see video.

The erratic thing is on ICS (Android 4.0.x) the video plays in the StageWebView but it horizontally closes to about 20% its normal width. The video player doesn't scale to 20% width, the iframe is just somehow collapsing to that narrow width removing the ability to see 80% of the video or use the controls (e.g. no fullscreen button visible).

When tested on Jelly Bean (4.1.x) the video does not pinch horizontally, it (amusingly) plays horizontally backwards (mirrored) and upside down.

Previously with hardwareAccelerated="true" missing I could press play and then toggle fullscreen and the video would work fine. After adding hardwareAccelerated="true" I can no longer use fullscreen, it crashes the devices after locking up.

I also tried appending ?html5=1 to the YouTube videos to force GoogleAPI to choose a HTML5 player. This didn't do anything.

Has anyone found the sacred tome of knowledge required to get an embedded YouTube video to play in a StageWebView iframe?

This topic has been closed for replies.

5 replies

Participating Frequently
November 12, 2014

StageWebView doesn't support HTML5.

Maybe you are not using the correct parameters for YouTube.

I'm using:

webkit

http://www.youtube.com/apiplayer?video_id=VIDEOID&autostart=1&autoplay=1&fs=0&controls=0&autohide=1&iv_load_policy=0&rel=0&start=0&showinfo=0&vq=hd720&

YouTube App

http://www.youtube.com/v/VIDEOID?autostart=1&autoplay=1&fs=1&controls=0&autohide=1&iv_load_policy=0&rel=0&start=0&showinfo=0&vq=hd720

Also make sure you are using the correct coordinates when setting the viewPort.

October 14, 2014

Hi, for me it's really strange that this bug is not resolved by Adobe yet. We can't play youtube videos on Android through our apps for a long time now. They appear flipped or if I enable hardware acceleration, the whole window appears black with strange effects. Also, feedback for the Adobe people, it's unacceptable not to have already a tutorial on how to integrate online videos on an app for Adobe AIR. Just by doing a research, everyone posts code working on Flash and not on Mobile (having problems with many things, including security). Using stagewebview proved easy on iOS and impossible on Android. Is there any other way to integrate a YouTube video on an Android app without appearing flipped or strange when not on full screen?

This is the result I get when integrating the youtube video through StageWebView. The background of the app is white but it keeps blinking between white and black. The image seems flipped and the area not filled looks as you see on the screenshot.

Inspiring
October 14, 2014

@gksa12: What AIR SDK are you using?

October 14, 2014

I have used both: 15.0.0.249 for Android and 13.0.0.83 for Android.

They both have the same effect. Is this happening only to me? I don't find it possible. I have tried it in more than one devices.

Inspiring
October 8, 2014

I can confirm constant app crashes on Android when displaying youtube content within StageWebView, going to fullscreen mode in the youtube player and then returnin to normal mode.

I have created a bug report here: Bug#3836092 - Android App crashes after returning from fullscreen to normal in StageWebView with YouTube content

Adobe Employee
January 3, 2014

Hi

Could you please open a new bug report on this over at https://bugbase.adobe.com?  When adding the bug, please include your sample code or a sample application so we can quickly test this out internally.

Once added, please post back with the URL so that others effected can add their comments and votes.  I'll also give the mobile team a heads up. 

Thanks

-Bo

sinious
siniousAuthor
Legend
January 6, 2014

Sure, here you go:

https://bugbase.adobe.com/index.cfm?event=bug&id=3689385

Screenshot of video on ASUS Transformer (4.0.3) pretty much sums up the rest of my devices, except my new Samsung Galaxy Note 3 (4.3) which works. Upside down video, whee!:

Participating Frequently
January 6, 2014

Sinuous, I'd love to talk to you more about this privately.  Contact me at

[Removed personal information] if you would.  Thanks.

Message was edited by: sinious

Participating Frequently
January 3, 2014

Hi, I think I am looking at the same issue right now.  Did you ever get a resolution?

sinious
siniousAuthor
Legend
January 3, 2014

Unfortunately not. I ended up writing an ANE to use the native video player app. The Android SWV has some serious limitations. You might want to test it well before you develop. As of AIR 3.9, video and iFrames just don't mix.