@granite-js/video 1.0.13 → 1.0.15
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/CHANGELOG.md +12 -0
- package/android/src/main/java/run/granite/video/GraniteVideoView.kt +0 -1
- package/android/src/main/java/run/granite/video/provider/GraniteVideoProvider.kt +0 -1
- package/android/src/media3/java/run/granite/video/provider/media3/ExoPlayerProvider.kt +3 -3
- package/android/src/test/java/run/granite/video/GraniteVideoViewRobolectricTest.kt +0 -2
- package/android/src/test/java/run/granite/video/helpers/FakeGraniteVideoProvider.kt +1 -1
- package/ios/GraniteVideoProvider.swift +0 -1
- package/ios/GraniteVideoView.mm +11 -2
- package/ios/Providers/AVPlayerProvider.swift +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @granite-js/video
|
|
2
2
|
|
|
3
|
+
## 1.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dfa2f63: Fix iOS video source headers not being passed to the native player
|
|
8
|
+
|
|
9
|
+
## 1.0.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4263c41: fix: video native prop
|
|
14
|
+
|
|
3
15
|
## 1.0.13
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -75,7 +75,6 @@ class GraniteVideoView @JvmOverloads constructor(
|
|
|
75
75
|
val videoSource = GraniteVideoSource(
|
|
76
76
|
uri = source["uri"] as? String,
|
|
77
77
|
type = source["type"] as? String,
|
|
78
|
-
startPosition = (source["startPosition"] as? Number)?.toDouble() ?: 0.0,
|
|
79
78
|
startTime = (source["startTime"] as? Number)?.toDouble() ?: 0.0,
|
|
80
79
|
endTime = (source["endTime"] as? Number)?.toDouble() ?: 0.0,
|
|
81
80
|
headers = headers,
|
|
@@ -33,7 +33,6 @@ enum class GraniteVideoAudioOutput {
|
|
|
33
33
|
data class GraniteVideoSource(
|
|
34
34
|
val uri: String? = null,
|
|
35
35
|
val type: String? = null,
|
|
36
|
-
val startPosition: Double = 0.0,
|
|
37
36
|
val startTime: Double = 0.0,
|
|
38
37
|
val endTime: Double = 0.0,
|
|
39
38
|
val headers: Map<String, String>? = null,
|
|
@@ -163,9 +163,9 @@ class ExoPlayerProvider(
|
|
|
163
163
|
player?.setMediaSource(mediaSource)
|
|
164
164
|
player?.prepare()
|
|
165
165
|
|
|
166
|
-
// Seek to start
|
|
167
|
-
if (source.
|
|
168
|
-
player?.seekTo(source.
|
|
166
|
+
// Seek to start time if specified
|
|
167
|
+
if (source.startTime > 0) {
|
|
168
|
+
player?.seekTo(source.startTime.toLong())
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -111,7 +111,6 @@ class GraniteVideoViewRobolectricTest {
|
|
|
111
111
|
val source = mapOf(
|
|
112
112
|
"uri" to "https://example.com/video.mp4",
|
|
113
113
|
"type" to "mp4",
|
|
114
|
-
"startPosition" to 10.0,
|
|
115
114
|
"headers" to mapOf("Authorization" to "Bearer token")
|
|
116
115
|
)
|
|
117
116
|
view.setSource(source)
|
|
@@ -120,7 +119,6 @@ class GraniteVideoViewRobolectricTest {
|
|
|
120
119
|
mockProvider.loadSource(match<GraniteVideoSource> {
|
|
121
120
|
it.uri == "https://example.com/video.mp4" &&
|
|
122
121
|
it.type == "mp4" &&
|
|
123
|
-
it.startPosition == 10.0 &&
|
|
124
122
|
it.headers?.get("Authorization") == "Bearer token"
|
|
125
123
|
})
|
|
126
124
|
}
|
|
@@ -40,7 +40,7 @@ class FakeGraniteVideoProvider(
|
|
|
40
40
|
override fun loadSource(source: GraniteVideoSource) {
|
|
41
41
|
lastLoadedSource = source
|
|
42
42
|
_duration = 0.0
|
|
43
|
-
_currentTime = source.
|
|
43
|
+
_currentTime = source.startTime
|
|
44
44
|
delegate?.onLoadStart(
|
|
45
45
|
isNetwork = source.uri?.startsWith("http") == true,
|
|
46
46
|
type = source.type ?: "unknown",
|
|
@@ -53,7 +53,6 @@ import AVFoundation
|
|
|
53
53
|
@objc public class GraniteVideoSource: NSObject {
|
|
54
54
|
@objc public var uri: String?
|
|
55
55
|
@objc public var type: String?
|
|
56
|
-
@objc public var startPosition: Double = 0
|
|
57
56
|
@objc public var startTime: Double = 0
|
|
58
57
|
@objc public var endTime: Double = 0
|
|
59
58
|
@objc public var headers: [String: String]?
|
package/ios/GraniteVideoView.mm
CHANGED
|
@@ -243,7 +243,17 @@ using namespace facebook::react;
|
|
|
243
243
|
videoSource.type = [NSString stringWithUTF8String:source.type.c_str()];
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
// source.headers (vector<{name, value}>) → NSDictionary 변환
|
|
247
|
+
if (!source.headers.empty()) {
|
|
248
|
+
NSMutableDictionary *headers = [NSMutableDictionary dictionary];
|
|
249
|
+
for (const auto &header : source.headers) {
|
|
250
|
+
NSString *name = [NSString stringWithUTF8String:header.name.c_str()];
|
|
251
|
+
NSString *value = [NSString stringWithUTF8String:header.value.c_str()];
|
|
252
|
+
headers[name] = value;
|
|
253
|
+
}
|
|
254
|
+
videoSource.headers = headers;
|
|
255
|
+
}
|
|
256
|
+
|
|
247
257
|
videoSource.startTime = source.startTime;
|
|
248
258
|
videoSource.endTime = source.endTime;
|
|
249
259
|
|
|
@@ -670,4 +680,3 @@ Class<RCTComponentViewProtocol> GraniteVideoViewCls(void)
|
|
|
670
680
|
{
|
|
671
681
|
return GraniteVideoView.class;
|
|
672
682
|
}
|
|
673
|
-
|
|
@@ -236,9 +236,9 @@ private class AVPlayerContainerView: UIView {
|
|
|
236
236
|
// Replace current item
|
|
237
237
|
player.replaceCurrentItem(with: item)
|
|
238
238
|
|
|
239
|
-
// Set start
|
|
240
|
-
if source.
|
|
241
|
-
let seekTime = CMTime(seconds: source.
|
|
239
|
+
// Set start time if specified
|
|
240
|
+
if source.startTime > 0 {
|
|
241
|
+
let seekTime = CMTime(seconds: source.startTime, preferredTimescale: CMTimeScale(NSEC_PER_SEC))
|
|
242
242
|
player.seek(to: seekTime)
|
|
243
243
|
}
|
|
244
244
|
|