Skip to main content
Djwaas
Participant
October 19, 2016
Answered

Youtube video in AIR iOS app isn't displayed anymore with AIR 23

  • October 19, 2016
  • 1 reply
  • 577 views

Hello everyone:

I'm updating my iOS AIR app, and when I compile my IPA file using AIR 23, Youtube videos refuse to show up within my app.

When I compile with AIR 20, everything goes back to normal, and youtube videos run normally on an iPhone.

I'm using the "StageWebView + iframe" method to display the video within the AIR app.

The code I use is written below, is there anything I need to change to make it compatible with AIR V23?    Thanks a lot!!!!

              webViewYoutube = new StageWebView();

               webViewYoutube.stage=stage;

              

               var htmlString:String = "<!DOCTYPE HTML>" +

                        "<html><body bgcolor="+ "Black" + "><script>" +

                        "var tag = document.createElement('script');"+

                        "tag.src = \"http://www.youtube.com/player_api\";"+

                        "var firstScriptTag = document.getElementsByTagName('script')[0];"+

                        "firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);"+

                        "var player;"+           

                        "function onYouTubeIframeAPIReady() {"+

                            "player = new YT.Player('player', {"+            

                              "events: {"+

                                "'onReady': onPlayerReady,"+

                              "}"+

                            "});"+

                        "}"+

                        "function onPlayerReady(event) {"+

                            "event.target.playVideo();"+

                        "}"+

                        "</script>"+

                        "<iframe id=\"player\" type=\"text/html\" width=\"100%\" height=\"100%\" src=\"http://www.youtube.com/embed/XXXXXXXXXX?autohide=1&controls=1&modestbranding=0&rel=0&showinfo=0\" frameborder=\"0\"></iframe>" +

                        "</body></html>";

               webViewYoutube.loadString(htmlString);

               swvHeight = stage.stageHeight;

               webViewYoutube.viewPort = new Rectangle(0, 0, this.stage.stageWidth, swvHeight);

This topic has been closed for replies.
Correct answer deesharm

Hi Wedrer,

I tried running your sample code at my end and it works fine with our latest AIR 23 Beta release build. Please find the download link below:

Download Adobe AIR 23 Beta - Adobe Labs

And Please specify exceptions to the default behavior by adding keys to InfoAdditions tag of application descriptor of your app.

URLRequest - Adobe ActionScript® 3 (AS3 ) API Reference

Let us know if it works for you.

Thanks,

Adobe AIR Team

1 reply

deesharm
Adobe Employee
deesharmCorrect answer
Adobe Employee
October 20, 2016

Hi Wedrer,

I tried running your sample code at my end and it works fine with our latest AIR 23 Beta release build. Please find the download link below:

Download Adobe AIR 23 Beta - Adobe Labs

And Please specify exceptions to the default behavior by adding keys to InfoAdditions tag of application descriptor of your app.

URLRequest - Adobe ActionScript® 3 (AS3 ) API Reference

Let us know if it works for you.

Thanks,

Adobe AIR Team

Djwaas
DjwaasAuthor
Participant
October 20, 2016

I found this chapter on the URLRequest API Reference page:

“App Transport Security is being introduced from Apple in iOS9, which doesn’t allow unsecure connections between App and Web services. Due to this change all the connections which are made to Unsecure web sites via Loader, URLLoader will discontinue and not work due to App Transport Security. Please specify exceptions to the default behaviour by adding keys to Info.plist in your app.”

Therefore, by simply changing my links from http:// to https://, everything worked like a charm!

Thanks a lot deesharm!!!