Skip to content

Embedded Youtube videos (iframe) have stopped working in iOS: Error 153 #701

@dpalou

Description

@dpalou

I think this is caused by some changes done by the Youtube team. According to this Youtube documentation, now it is mandatory to send a Referer to the Youtube page when embedding it, and the Ionic WebView doesn't send any Referer in iOS. In Android this works fine.

I tried modifying the plugin's code to add a Referer, but the WebView still doesn't send it. Before executing the WebView's loadRequest, I tried to add the Referer to the request as suggested by the Youtube documentation:

[request addValue:@"https://my.test.app" forHTTPHeaderField:@"Referer"];

But if I inspect the Network requests this Referer isn't sent and the videos still don't work.

I was able to reproduce this in an Ionic blank app. I'm using Cordova and Angular. After creating a blank app, I just added an iframe pointing to a Youtube video in the home.page.html and I allowed the requests both in the CSP and using allow-navigation in the config.xml. The result was that Youtube displays an Error 153 instead of the video:

Image

This is an important issue for us because Youtube videos are used in our app and now they don't work at all in iOS. A possible workaround is to open the videos in InAppBrowser or an external browser, but we'd like to avoid that if possible.

Is there any way to make the Ionic WebView send the Referer in iOS?

I'll be happy to provide more information or perform more tests if needed :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions