@pigeonmal/react-native-video 7.0.0-beta.16 → 7.0.0-beta.18

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/README.md CHANGED
@@ -1,15 +1,24 @@
1
1
  Last commit sync : 605feed68a4be9ff8fcfa2f288d4f0570f044699
2
2
  Date: 19/12/2025
3
3
 
4
- (Only android)
5
- Install :
4
+ Only android !!
5
+
6
+ New install (custom cronet) :
6
7
  npm install @pigeonmal/react-native-video@beta @pigeonmal/react-native-nitro-fetch
8
+
9
+ Add this in **settings.gradle**
10
+ include ':cronet-release'
11
+ project(':cronet-release').projectDir = file('../../node_modules/@pigeonmal/react-native-nitro-fetch/android/cronet-release')
12
+
13
+ Old install (playstore cronet +0.1mb apk) :
14
+ npm i @pigeonmal/react-native-video@7.0.0-beta.17 @pigeonmal/react-native-nitro-fetch@0.1.9
7
15
  ---
8
16
 
9
17
  Features:
10
18
 
19
+ - bring custom cronet v143.0.7499.146 with DOH cloudflare
11
20
  - modern media3 1.8.0
12
- - ffmpeg fallback
21
+ - ffmpeg fallback (audios + videos only if device is not tv)
13
22
  - videoconfig: externalAudios (array of AudioTrack)
14
23
  - videoconfig: forceType 'm3u8' or 'mpd' if url not have explicit extension
15
24
  - videoconfig: forceOkhttp cronet by default but still okhttp work
@@ -187,6 +187,7 @@ android {
187
187
  java.srcDirs += ["src/stubs/hls"]
188
188
  }
189
189
  java.srcDirs += ["src/stubs/subs"]
190
+ java.srcDirs += ["src/stubs/cronet"]
190
191
  }
191
192
  }
192
193
  }
@@ -226,7 +227,6 @@ dependencies {
226
227
  // Common functionality for loading data
227
228
  implementation "androidx.media3:media3-datasource:$media3_version"
228
229
 
229
- implementation "androidx.media3:media3-datasource-cronet:$media3_version"
230
230
  implementation "androidx.media3:media3-datasource-okhttp:$media3_version"
231
231
 
232
232
 
@@ -4,11 +4,16 @@ import android.content.Context
4
4
  import android.content.pm.PackageManager
5
5
 
6
6
  object TvDetector {
7
- @Volatile private var cached = false
8
-
7
+
8
+ @Volatile
9
+ private var cachedIsTv: Boolean? = null
10
+
9
11
  fun isTv(context: Context): Boolean {
10
- if (cached) return true
11
- cached = context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
12
- return cached
12
+ return cachedIsTv ?: synchronized(this) {
13
+ cachedIsTv ?: context.applicationContext
14
+ .packageManager
15
+ .hasSystemFeature(PackageManager.FEATURE_LEANBACK)
16
+ .also { cachedIsTv = it }
17
+ }
13
18
  }
14
19
  }
@@ -570,6 +570,9 @@ class HybridVideoPlayer() : HybridVideoPlayerSpec(), AutoCloseable {
570
570
  newPosition: Player.PositionInfo,
571
571
  reason: Int
572
572
  ) {
573
+ if (source == null) {
574
+ return
575
+ }
573
576
  if (reason == Player.DISCONTINUITY_REASON_SEEK || reason == Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT) {
574
577
  eventEmitter.onSeek(newPosition.positionMs / 1000.0)
575
578
  }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Copyright (C) 2016 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package androidx.media3.datasource.cronet;
17
+
18
+ import static java.lang.Math.min;
19
+
20
+ import java.io.IOException;
21
+ import java.nio.ByteBuffer;
22
+ import org.chromium.net.UploadDataProvider;
23
+ import org.chromium.net.UploadDataSink;
24
+
25
+ /** A {@link UploadDataProvider} implementation that provides data from a {@code byte[]}. */
26
+ /* package */ final class ByteArrayUploadDataProvider extends UploadDataProvider {
27
+
28
+ private final byte[] data;
29
+
30
+ private int position;
31
+
32
+ public ByteArrayUploadDataProvider(byte[] data) {
33
+ this.data = data;
34
+ }
35
+
36
+ @Override
37
+ public long getLength() {
38
+ return data.length;
39
+ }
40
+
41
+ @Override
42
+ public void read(UploadDataSink uploadDataSink, ByteBuffer byteBuffer) throws IOException {
43
+ int readLength = min(byteBuffer.remaining(), data.length - position);
44
+ byteBuffer.put(data, position, readLength);
45
+ position += readLength;
46
+ uploadDataSink.onReadSucceeded(false);
47
+ }
48
+
49
+ @Override
50
+ public void rewind(UploadDataSink uploadDataSink) throws IOException {
51
+ position = 0;
52
+ uploadDataSink.onRewindSucceeded();
53
+ }
54
+ }