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.
@@ -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"
@@ -8,6 +8,6 @@
8
8
  android:clipToPadding="false"
9
9
  app:surface_type="surface_view"
10
10
  app:controller_layout_id="@layout/custom_player_control_view"
11
- app:show_timeout="3000"
11
+ app:show_timeout="4000"
12
12
  app:touch_target_height="12dp"
13
13
  app:bar_height="5dp" />
@@ -8,6 +8,6 @@
8
8
  android:clipChildren="false"
9
9
  android:clipToPadding="false"
10
10
  app:controller_layout_id="@layout/custom_player_control_view"
11
- app:show_timeout="3000"
11
+ app:show_timeout="4000"
12
12
  app:touch_target_height="12dp"
13
13
  app:bar_height="5dp" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unified-player",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Unified Player",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",