Highlighted

Displaying a Youtube video within an AIR Android app

Explorer ,
Jul 07, 2015

Copy link to clipboard

Copied

Hello;

I'm trying to display a Youtube video within an AIR Android app.

Usually, I call the Youtube API player like this (barebones only):

loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));

player = loader.content;

player.loadVideoById("12345678901",0);

I don't know why, but this method doesn't work anymore.

Here's what happens on the ANDROID device (I compiled using AIR v18):

The video seems to be buffering for a few seconds, then the movieClip holding the API player becomes transparent, no video is displayed.

The sound of the video is playing though.

Meanwhile, on the ADL, the video shows up as it should.

I'm using Android 5, the Youtube Video is on public status, and I already re-tried after uninstalling the Android app (but does it clear the cache?).

Does anybody has a clue on what's going on?

Thanks a lot!

Could you check if you have hardwareAccelerated being set to true in your application descriptor?

<android>

     <manifestAdditions>

          <![CDATA[

          <manifest>

               <application android:hardwareAccelerated="true"/>

          </manifest> ]]>

     </manifestAdditions>

</android>

Also, check if you are using the <containsVideo> tag in your app descriptor since this may cause problems.

TOPICS
Development

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Displaying a Youtube video within an AIR Android app

Explorer ,
Jul 07, 2015

Copy link to clipboard

Copied

Hello;

I'm trying to display a Youtube video within an AIR Android app.

Usually, I call the Youtube API player like this (barebones only):

loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));

player = loader.content;

player.loadVideoById("12345678901",0);

I don't know why, but this method doesn't work anymore.

Here's what happens on the ANDROID device (I compiled using AIR v18):

The video seems to be buffering for a few seconds, then the movieClip holding the API player becomes transparent, no video is displayed.

The sound of the video is playing though.

Meanwhile, on the ADL, the video shows up as it should.

I'm using Android 5, the Youtube Video is on public status, and I already re-tried after uninstalling the Android app (but does it clear the cache?).

Does anybody has a clue on what's going on?

Thanks a lot!

Could you check if you have hardwareAccelerated being set to true in your application descriptor?

<android>

     <manifestAdditions>

          <![CDATA[

          <manifest>

               <application android:hardwareAccelerated="true"/>

          </manifest> ]]>

     </manifestAdditions>

</android>

Also, check if you are using the <containsVideo> tag in your app descriptor since this may cause problems.

TOPICS
Development

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 07, 2015 0
Participant ,
Jul 08, 2015

Copy link to clipboard

Copied

Could you check if you have hardwareAccelerated being set to true in your application descriptor?

<android>

     <manifestAdditions>

          <![CDATA[

          <manifest>

               <application android:hardwareAccelerated="true"/>

          </manifest> ]]>

     </manifestAdditions>

</android>

Also, check if you are using the <containsVideo> tag in your app descriptor since this may cause problems.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2015 0
Explorer ,
Jul 08, 2015

Copy link to clipboard

Copied

Hi:

I compiled the app in CPU mode, then GPU then DIRECT mode.

In each mode, I've set <application android:hardwareAccelerated="true"/> then to false.

Result is the same: The Youtube video is transparent but the sound is there.

There's no <containsVideo> tag in my descriptor, since it's a simple descriptor as generated by Flash pro CS6.

Google officially says that the YouTube ActionScript 3.0 Player API has been DEPRECATED: developers.google.com/youtube/flash_api_reference?hl=en  (PS: DEPRECATED doesn't mean necessarely Dropped).

So I tried the StageWebView + iFrame solution as described here: developers.google.com/youtube/iframe_api_reference

The results are still not good: Video Thumbnail is displayed, but when the play button is hit, the buffering circles are displayed and I get stuck there.


Any help?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2015 0
Participant ,
Jul 09, 2015

Copy link to clipboard

Copied

In one of our apps (iOS, Android) we are using StageWebView displaying YouTube video, which works well. I have just checked and found out that for the Android version StageVideo is explicitly disabled (I'm sure I've had similar issues with Android devices not displaying the video) - the following might work for you, too:

import org.osmf.utils.OSMFSettings;

OSMFSettings.enableStageVideo = false;

Also, in the application descriptor containsVideo is set to true:

<android>

  <colorDepth>16bit</colorDepth>

  <manifestAdditions>

  <![CDATA[

  [...]

  ]]>

  </manifestAdditions>

<containsVideo>true</containsVideo>

</android>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 09, 2015 0
Djwaas LATEST
Explorer ,
Jul 09, 2015

Copy link to clipboard

Copied

Dear Jan-F-W:

Thanks a lot for your help!!!

It turned out that your previous suggestion (setting hardwareAccelerated="true") is the way to go!!

When I was trying to test it, Flash PRO was having a weird bug: newly compiled apk files don't replace the old one already on the phone.

That's why I wrote in my previous post that it was not working (I was testing the same APK again and again!).

Anyway, now I've set hardwareAccelerated="true", and tested Youtube videos nested inside StageWebView or StageWebViewBridge instances and it works like a charm!

I see no point now to test the containsVideo=true suggestion, but thanks again anyway.

One last thing, do you happen to know if there's a way to remove all the Youtube links that surround the video player and that takes the user to the youtube website if clicked?

Thanks again Jan-F-W!!!

Best regards.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 09, 2015 0