Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actual fun YoutubePlayerComponentPlatform(videoId: String, modifier: Modifier) {
AndroidView(
modifier = modifier,
factory = { webView },
update = { it.loadDataWithBaseURL(null, embedHTML, "text/html", "UTF-8", null) },
update = { it.loadDataWithBaseURL(CODANDOTV_DOMAIN, embedHTML, "text/html", "UTF-8", null) },
onReset = { it.destroy() }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ expect fun YoutubePlayerComponentPlatform(videoId: String, modifier: Modifier =


internal fun String.videoIdToEmbedHTML(): String {
val iframeProperties = "width=\"100%\" height=\"100%\""
return "<iframe $iframeProperties" +
"src=\"https://www.youtube.com/embed/$this?playsinline=1\" " +
"frameborder=\"0\" allowfullscreen></iframe>"
return """
<iframe width="100%" height="100%"
src="https://www.youtube.com/embed/$this?playsinline=1"
frameborder="0" allowfullscreen referrerpolicy="strict-origin-when-cross-origin"/>
""".trimIndent()
}

internal const val CODANDOTV_DOMAIN = "https://com.codandotv.com/streamplayerapp"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.UIKitView
import platform.Foundation.NSURL
import platform.WebKit.WKWebView
import platform.WebKit.WKWebViewConfiguration
import platform.WebKit.WKWebsiteDataStore
Expand All @@ -23,7 +24,7 @@ actual fun YoutubePlayerComponentPlatform(videoId: String, modifier: Modifier){
configuration.limitsNavigationsToAppBoundDomains = false
loadHTMLString(
string = embedHTML,
baseURL = null
baseURL = NSURL(string = CODANDOTV_DOMAIN),
)
}
}
Expand Down