I am developing an android app with twitch api.
I want to show some clip video.
I read the guide document: Video & Clips | Twitch Developers
val html = "<iframe src=\"${clipUrl}&parent=localhost\" height=\"360\" width=\"640\" allowfullscreen/>"
val context = LocalContext.current
AndroidView(
factory = {
WebView(context).apply {
webViewClient = WebViewClient()
webChromeClient = WebChromeClient()
settings.loadsImagesAutomatically = true
settings.javaScriptEnabled = true
settings.allowFileAccess = true
settings.javaScriptCanOpenWindowsAutomatically = true
settings.pluginState = WebSettings.PluginState.ON
settings.mediaPlaybackRequiresUserGesture = false
settings.domStorageEnabled = true
settings.setAppCacheMaxSize(1024 * 8)
settings.setRenderPriority(WebSettings.RenderPriority.HIGH)
settings.cacheMode = WebSettings.LOAD_NO_CACHE
settings.setAppCacheEnabled(true)
requestFocus(View.FOCUS_DOWN)
loadDataWithBaseURL(null, html, "text/html", "UTF-8", null)
}
}
)
When I run it, it shows “Unavailable page” with error: ERR_BLOCKED_BY_RESPONSE
.
log:
[INFO:CONSOLE(0)] "Refused to frame 'https://clips.twitch.tv/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors http://localhost:* https://localhost:*".
", source: (0)
How can I do this?
And, what is the parent?
Because I am Android app developer, I don’t know well about other domain, So I couldn’t understand the parent
param.