webView cannot play YouTube video suddenly (iOS device)

There was no problem at all for webView to play a YouTube video inside a web page.

Since a few days ago, webView cannot play YouTube videos at all. I thought it was just temporary due to my own network connection problem.

Now I started to get user complaints about my app cannot play YouTube videos.

Following is a testing code,

local webView = native.newWebView(0, 0, display.contentWidth, display.contentHeight) webView.x = display.contentWidth \* 0.5 webView.y = display.contentHeight \* 0.5 webView:request("http://www.upworthy.com/matt-damon-asked-a-cheery-13-year-old-what-shell-do-with-her-free-time-her-answer-gave-him-pause?c=reccon1")

You can request any webpage that contains a YouTube video in it, and you will see when you click on Play, the loading indicator spins a bit, and then nothing happens (all black), no matter how long you wait.

This only happens in iOS devices, not Android devices nor Simulator.

Even if I build the app with earlier Corona build, the problem still exists.

What do you think that made this happen? YouTube? And even if it’s YouTube, can Corona do something about it?

PS. If you go to YouTube website via webView, the videos can be played over there. However, this problem happens for a webpage that contains (embeds) a YouTube video.

I have experienced the same issue. But it seems that it was on Google ends and they fixed the issue now, try again and see if you can play YouTube embed videos. 

Thanks a lot for your reply.

I just tested again. It is ok now.

But it’s still weird enough because when the YouTube video couldn’t be played by our webView, it could still be played within Safari from my testing.

I mean even if Google made some thing wrong, why Safari (other browsers) could still play it? Why not our webView?

Now I found when I play a Youtube video in an Android device (I tested with Galaxy Tab 3)

it can be played, however when I click on the full-screen icon

the video gets stuck but the sound continues… it’s not playing in full-screen mode at all?

Is your Android device having the same problem?

Just use the code here:

local webView = native.newWebView(0, 0, display.contentWidth, display.contentHeight) webView.x = display.contentWidth \* 0.5 webView.y = display.contentHeight \* 0.5 webView:request("http://www.upworthy.com/matt-damon-asked-a-cheery-13-year-old-what-shell-do-with-her-free-time-her-answer-gave-him-pause?c=reccon1")

It’s happening again now.

For the same URL that contains Youtube video, it can be played in Safari & other browsers.

Corona webView really sucks.

Are you using ads? 

I found that ads (in my case inneractive) are causing problems for webview.

Yes, I use adMob ad in my published app.

But the problem I am describing here is unrelated to ad. The testing code (my first post) only has a few lines, it’s simple enough. And when the problem happens, youTube video just can’t be played even with this testing code.

I just tested again, youTube can be played now.

The problem I am seeing now is:

(1) youTube in webView cannot be played suddenly in my iPhone.

(2) I open Safari/Chrome in my iPhone for the exact the same URL, youTube can be played.

(3) After a while (probably days or hours), youTube in webView can be played.

Google’s fault? 

My problem is unrelated to the ads, everything works well until the ad is loaded. 

I load a remote webpage in webview off screen then bring it into view when a button is pressed and bring it off screen again when the “submit” button in the html of the page is pressed.

All works well as many times as I want UNTIL an ad is loaded. When I close the ad (it’s a fullscreen ad) and the ad goes away you would think that all will still work. But it doesn’t. When I bring the webview into view (moving the box x coordinate) it comes into view but nothing works on the page anymore, the “submit” button doesn’t react and the page lets touch events pass to buttons under it.

The ad is modifying something and leaving it there even after it is closed.

Try a build of your app without using any ads and see if the weird behaviour still happens.

I have experienced the same issue. But it seems that it was on Google ends and they fixed the issue now, try again and see if you can play YouTube embed videos. 

Thanks a lot for your reply.

I just tested again. It is ok now.

But it’s still weird enough because when the YouTube video couldn’t be played by our webView, it could still be played within Safari from my testing.

I mean even if Google made some thing wrong, why Safari (other browsers) could still play it? Why not our webView?

Now I found when I play a Youtube video in an Android device (I tested with Galaxy Tab 3)

it can be played, however when I click on the full-screen icon

the video gets stuck but the sound continues… it’s not playing in full-screen mode at all?

Is your Android device having the same problem?

Just use the code here:

local webView = native.newWebView(0, 0, display.contentWidth, display.contentHeight) webView.x = display.contentWidth \* 0.5 webView.y = display.contentHeight \* 0.5 webView:request("http://www.upworthy.com/matt-damon-asked-a-cheery-13-year-old-what-shell-do-with-her-free-time-her-answer-gave-him-pause?c=reccon1")

It’s happening again now.

For the same URL that contains Youtube video, it can be played in Safari & other browsers.

Corona webView really sucks.

Are you using ads? 

I found that ads (in my case inneractive) are causing problems for webview.

Yes, I use adMob ad in my published app.

But the problem I am describing here is unrelated to ad. The testing code (my first post) only has a few lines, it’s simple enough. And when the problem happens, youTube video just can’t be played even with this testing code.

I just tested again, youTube can be played now.

The problem I am seeing now is:

(1) youTube in webView cannot be played suddenly in my iPhone.

(2) I open Safari/Chrome in my iPhone for the exact the same URL, youTube can be played.

(3) After a while (probably days or hours), youTube in webView can be played.

Google’s fault? 

My problem is unrelated to the ads, everything works well until the ad is loaded. 

I load a remote webpage in webview off screen then bring it into view when a button is pressed and bring it off screen again when the “submit” button in the html of the page is pressed.

All works well as many times as I want UNTIL an ad is loaded. When I close the ad (it’s a fullscreen ad) and the ad goes away you would think that all will still work. But it doesn’t. When I bring the webview into view (moving the box x coordinate) it comes into view but nothing works on the page anymore, the “submit” button doesn’t react and the page lets touch events pass to buttons under it.

The ad is modifying something and leaving it there even after it is closed.

Try a build of your app without using any ads and see if the weird behaviour still happens.