Skip to content

Commit

Permalink
Update p2pml to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaDemchenko committed Nov 27, 2024
1 parent 9cb8d6b commit 8ca993b
Show file tree
Hide file tree
Showing 5 changed files with 915 additions and 887 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/example/exoplayer/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class LoggingDataSourceFactory(context: Context) : DataSource.Factory {

@UnstableApi
class MainActivity : ComponentActivity() {
private var p2pServer = P2PML()
private var p2pServer = P2PML("{\"swarmId\":\"TEST_KOTLIN\"}")
private lateinit var player: ExoPlayer


Expand All @@ -99,7 +99,7 @@ class MainActivity : ComponentActivity() {
p2pServer.initialize(this@MainActivity, lifecycleScope)

val manifest =
p2pServer.getServerManifestUrl(Streams.HLS_LIVE_STREAM)
p2pServer.getServerManifestUrl(Streams.HLS_BIG_BUCK_BUNNY_QUALITY_4)

val loggingDataSourceFactory = LoggingDataSourceFactory(this@MainActivity)
val mediaSource = HlsMediaSource.Factory(loggingDataSourceFactory).createMediaSource(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/example/exoplayer/Streams.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.exoplayer

object Streams {
const val HLS_BIG_BUCK_BUNNY = "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
const val HLS_BIG_BUCK_BUNNY_QUALITY_4 = "https://test-streams.mux.dev/x36xhzz/url_0/193039199_mp4_h264_aac_hd_7.m3u8"
const val HLS_BYTE_RANGE_BIP_BOP_16X9 = "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8"
const val HLS_BYTE_RANGE_BIP_BOP_16X9_GEAR1 = "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/gear1/prog_index.m3u8"
const val HLS_ADVANCED_STREAM = "https://devstreaming-cdn.apple.com/videos/streaming/examples/adv_dv_atmos/main.m3u8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal class WebViewManager(
@SuppressLint("SetJavaScriptEnabled")
private val webView = WebView(context).apply {
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
webViewClient = WebViewClientCompat()
visibility = View.GONE
addJavascriptInterface(JavaScriptInterface(onPageLoadFinished), "Android")
Expand Down
2 changes: 1 addition & 1 deletion p2pml/src/main/resources/p2pml/static/core.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
updatePlaybackInfo(playbackInfoJSON) {
const playbackInfo = JSON.parse(playbackInfoJSON);
const { currentPlayPosition, currentPlaySpeed } = playbackInfo;
console.log(">> currentPlayback:", currentPlayPosition);
// console.log(">> currentPlayback:", currentPlayPosition);
this.core.updatePlayback(currentPlayPosition, currentPlaySpeed);
}
}
Expand Down
Loading

0 comments on commit 8ca993b

Please sign in to comment.