diff --git a/app/build.gradle b/app/build.gradle
index 135b8e7..4de626d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -47,6 +47,9 @@ android {
}
}
+ext.jwPlayerVersion = '4.6.0'
+ext.exoplayerVersion = '2.19.1'
+
dependencies {
implementation "com.airbnb.android:lottie:6.4.0"
implementation "androidx.core:core-splashscreen:1.0.1"
@@ -74,6 +77,10 @@ dependencies {
// circle image view
implementation 'de.hdodenhof:circleimageview:3.1.0'
+ // jwplayer
+ implementation "com.jwplayer:jwplayer-core:$jwPlayerVersion"
+ implementation "com.jwplayer:jwplayer-common:$jwPlayerVersion"
+
implementation libs.androidx.core.ktx
implementation libs.androidx.appcompat
implementation libs.material
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0775126..8b4a8f8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,11 +15,19 @@
android:supportsRtl="true"
android:theme="@style/Theme.Woka"
tools:targetApi="31">
+
+ android:screenOrientation="portrait"
+ android:theme="@style/TransparentActivity" />
+ val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
+ v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
+ insets
+ }
+
+ val windowInsetsController =
+ WindowCompat.getInsetsController(window, window.decorView)
+ windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
+
+ setUpPlayer()
+
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ player.stop()
+ }
+
+ private fun setUpPlayer() {
+ player = binding.playerView.player
+
+ player.setFullscreenHandler(this)
+
+ player.setFullscreen(true, false)
+
+ player.addListener(EventType.ERROR, VideoPlayerEvents.OnErrorListener {
+ Log.d(TAG, "onError: ${it.errorCode}")
+ Log.d(TAG, "onError: ${it.exception}")
+ Log.d(TAG, "onError: ${it.message}")
+ })
+
+ player.addListener(EventType.SETUP_ERROR, VideoPlayerEvents.OnSetupErrorListener {
+ Log.d(TAG, "setUpPlayer: $it")
+ })
+
+ // to keep up the screen om when video is being played
+ KeepScreenOnHandler(player, window)
+
+ val playlistItem = PlaylistItem.Builder()
+ .file("https://d3volyx7jx7oal.cloudfront.net/master.m3u8")
+ .mediaId("YR5pnlIM")
+ .build()
+ val playlist: MutableList = ArrayList()
+ playlist.add(playlistItem)
+
+ val config =
+ PlayerConfig.Builder()
+ .playlist(playlist)
+ .build()
+ player.setup(config)
+ player.play()
+ }
+
+ override fun onFullscreenRequested() {}
+
+ override fun onFullscreenExitRequested() {
+ player.stop()
+ onBackPressedDispatcher.onBackPressed()
+ }
+
+ override fun onAllowRotationChanged(allowRotation: Boolean) {}
+
+ override fun updateLayoutParams(layoutParams: ViewGroup.LayoutParams?) {}
+
+ override fun setUseFullscreenLayoutFlags(flags: Boolean) {}
+
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_live_stream_player.xml b/app/src/main/res/layout/activity_live_stream_player.xml
new file mode 100644
index 0000000..2bf621f
--- /dev/null
+++ b/app/src/main/res/layout/activity_live_stream_player.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home2.xml b/app/src/main/res/layout/fragment_home2.xml
index 73ac96f..d93efa1 100644
--- a/app/src/main/res/layout/fragment_home2.xml
+++ b/app/src/main/res/layout/fragment_home2.xml
@@ -113,25 +113,22 @@
-
@@ -141,7 +138,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
- app:layout_constraintGuide_percent="0.35"/>
+ app:layout_constraintGuide_percent="0.4"/>
+
+
true
+
+
+
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 50cce35..b4239fe 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -21,6 +21,7 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
+android.enableJetifier=true
# BASE URLS
diff --git a/settings.gradle b/settings.gradle
index c5683b7..5f9745f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,6 +16,9 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
+ maven {
+ url 'https://mvn.jwplayer.com/content/repositories/releases/'
+ }
}
}