react-native-unified-player 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/unifiedplayer/core/fragments/FullscreenVideoFragment.kt +26 -0
- package/android/src/main/res/layout/custom_player_control_view.xml +12 -0
- package/android/src/main/res/layout/player_view_surface.xml +1 -1
- package/android/src/main/res/layout/player_view_texture.xml +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import android.view.WindowInsetsController
|
|
|
15
15
|
import android.view.WindowManager
|
|
16
16
|
import android.widget.FrameLayout
|
|
17
17
|
import android.widget.ImageButton
|
|
18
|
+
import android.widget.TextView
|
|
18
19
|
import androidx.activity.OnBackPressedCallback
|
|
19
20
|
import androidx.annotation.OptIn
|
|
20
21
|
import androidx.core.view.isVisible
|
|
@@ -180,6 +181,31 @@ class FullscreenVideoFragment(private val videoView: VideoView) : Fragment() {
|
|
|
180
181
|
|
|
181
182
|
// Add close button after player view so it's on top
|
|
182
183
|
setupCloseButton()
|
|
184
|
+
|
|
185
|
+
// Add playback speed button logic
|
|
186
|
+
setupPlaybackSpeedButton()
|
|
187
|
+
|
|
188
|
+
// Show controller initially
|
|
189
|
+
videoView.playerView.showController()
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private fun setupPlaybackSpeedButton() {
|
|
193
|
+
val speedButton = videoView.playerView.findViewById<TextView>(com.unifiedplayer.R.id.exo_playback_speed)
|
|
194
|
+
|
|
195
|
+
speedButton?.setOnClickListener {
|
|
196
|
+
val player = videoView.playerView.player ?: return@setOnClickListener
|
|
197
|
+
val currentSpeed = player.playbackParameters.speed
|
|
198
|
+
|
|
199
|
+
val nextSpeed = when (currentSpeed) {
|
|
200
|
+
1.0f -> 2.0f
|
|
201
|
+
2.0f -> 4.0f
|
|
202
|
+
4.0f -> 1.0f
|
|
203
|
+
else -> 1.0f
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
player.setPlaybackSpeed(nextSpeed)
|
|
207
|
+
speedButton.text = "${nextSpeed}x"
|
|
208
|
+
}
|
|
183
209
|
}
|
|
184
210
|
|
|
185
211
|
private fun setupCloseButton() {
|
|
@@ -57,6 +57,18 @@
|
|
|
57
57
|
android:paddingLeft="4dp"
|
|
58
58
|
android:paddingRight="4dp"
|
|
59
59
|
android:includeFontPadding="false"
|
|
60
|
+
|
|
61
|
+
android:textColor="#FFBEBEBE"/>
|
|
62
|
+
|
|
63
|
+
<TextView android:id="@+id/exo_playback_speed"
|
|
64
|
+
android:layout_width="wrap_content"
|
|
65
|
+
android:layout_height="wrap_content"
|
|
66
|
+
android:textSize="14sp"
|
|
67
|
+
android:textStyle="bold"
|
|
68
|
+
android:paddingLeft="8dp"
|
|
69
|
+
android:paddingRight="8dp"
|
|
70
|
+
android:includeFontPadding="false"
|
|
71
|
+
android:text="1.0x"
|
|
60
72
|
android:textColor="#FFBEBEBE"/>
|
|
61
73
|
|
|
62
74
|
<ImageButton android:id="@id/exo_fullscreen"
|