Highlighted

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

Explorer ,
Oct 19, 2016

Copy link to clipboard

Copied

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);

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

TOPICS
Development

Views

311

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

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

Explorer ,
Oct 19, 2016

Copy link to clipboard

Copied

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);

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

TOPICS
Development

Views

312

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
Oct 19, 2016 0
Adobe Employee ,
Oct 20, 2016

Copy link to clipboard

Copied

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

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...
Oct 20, 2016 0
Djwaas LATEST
Explorer ,
Oct 20, 2016

Copy link to clipboard

Copied

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!!!

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...
Oct 20, 2016 0