Refused to load the image 'android-webview-video-poster:default_video_poster' because it violates CSP

android

#1

Hello,

I’m trying to embed videos into Android webview. Here is the following html code:
https://jsfiddle.net/6tb4md3d/2/

It works fine in jsfiddle, but when I load a HTML that looks like this in Android webview, I see it successfully load the thumbnail of the video. When I click play button, it gives me a popup saying,
“By playing this video you agree to Twitter’s use of cookies…”

I hit “OK”, and it shows “The media could not be played”.

In the log, I see:

Refused to load the image 'android-webview-video-poster:default_video_poster/8443874430566469765' because it violates the following Content Security Policy directive: "img-src 'self' http://localhost:* http://localhost.twitter.com:* https://*.twitter.com https://*.twimg.com https://vine.co https://*.vine.co https://*.periscope.tv https://*.pscp.tv blob: data:".

I’ve tried https://stackoverflow.com/questions/38277526/webview-content-security-policy but I believe its the CSP in the iframe html, so I have no control over that CSP.

I read Display embedded tweet with video in Android WebView and I cannot use TweetView because I am not able to bring in new dependency to my build.gradle by just specifying an address. I am only able to add in dependency through .jar file or through maven central repository or PyPI or RubyGems or CPAN (please share/guide if either exist).

Here are the culprits:

This iframe url does not allow to load ‘android-webview-video-poster:default_video_poster’ because it specifies a CSP that prevents it:
https://twitter.com/i/videos/tweet/834457961233862661?embed_source=clientlib&player_id=0&rpc_init=1&language_code=en&use_syndication_guest_id=true

How to fix?
Please add ‘android-webview-video-poster:default_video_poster’ to img-src of CSP in embed_source html

Thanks,


#2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.