react-native-unified-player 0.5.0 → 0.5.5
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
|
@@ -151,6 +151,10 @@ Control playback using the `UnifiedPlayer` object and the native tag of the `Uni
|
|
|
151
151
|
yarn android # for Android
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
## Publishing
|
|
155
|
+
|
|
156
|
+
This package is automatically published to npm when changes are pushed to the `main` or `master` branch. See [PUBLISHING.md](.github/PUBLISHING.md) for setup instructions and details about npm's new authentication system (granular access tokens).
|
|
157
|
+
|
|
154
158
|
## Contributing
|
|
155
159
|
|
|
156
160
|
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
@@ -149,10 +149,14 @@ class UnifiedPlayerView(context: Context) : FrameLayout(context) {
|
|
|
149
149
|
startProgressUpdates()
|
|
150
150
|
}
|
|
151
151
|
Player.STATE_ENDED -> {
|
|
152
|
-
Log.d(TAG, "ExoPlayer STATE_ENDED")
|
|
153
|
-
// ExoPlayer handles looping via repeatMode
|
|
154
|
-
if
|
|
152
|
+
Log.d(TAG, "ExoPlayer STATE_ENDED, loop: $loop, repeatMode: ${player?.repeatMode}")
|
|
153
|
+
// ExoPlayer handles looping via repeatMode, but we still need to check
|
|
154
|
+
// Only send completion event if not looping
|
|
155
|
+
if (!loop && player?.repeatMode != Player.REPEAT_MODE_ONE) {
|
|
156
|
+
Log.d(TAG, "Sending playback complete event")
|
|
155
157
|
sendEvent(EVENT_COMPLETE, Arguments.createMap())
|
|
158
|
+
} else {
|
|
159
|
+
Log.d(TAG, "Looping enabled, not sending completion event")
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
Player.STATE_BUFFERING -> {
|
|
@@ -294,6 +294,9 @@
|
|
|
294
294
|
[mediaOptions addObject:@"--http-reconnect"];
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
// Note: We handle looping manually in the Ended state instead of using VLC's input-repeat
|
|
298
|
+
// This is more reliable and works even when loop prop changes after media is loaded
|
|
299
|
+
|
|
297
300
|
// Add custom media options if provided
|
|
298
301
|
if (self->_mediaOptions && self->_mediaOptions.count > 0) {
|
|
299
302
|
for (NSString *option in self->_mediaOptions) {
|
|
@@ -713,7 +716,16 @@
|
|
|
713
716
|
}
|
|
714
717
|
|
|
715
718
|
- (void)setLoop:(BOOL)loop {
|
|
719
|
+
BOOL wasLooping = _loop;
|
|
720
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] Setting loop to: %@ (was: %@)", loop ? @"YES" : @"NO", wasLooping ? @"YES" : @"NO");
|
|
716
721
|
_loop = loop;
|
|
722
|
+
|
|
723
|
+
// If loop changed and we have media loaded, we might need to reload
|
|
724
|
+
// However, VLC's input-repeat needs to be set when media is created
|
|
725
|
+
// So we'll handle looping manually in the Ended state instead
|
|
726
|
+
if (_player && _player.media && loop != wasLooping) {
|
|
727
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] Loop changed, will handle in Ended state. Current state: %d", (int)_player.state);
|
|
728
|
+
}
|
|
717
729
|
}
|
|
718
730
|
|
|
719
731
|
- (void)setIsPaused:(BOOL)isPaused {
|
|
@@ -957,14 +969,24 @@
|
|
|
957
969
|
break;
|
|
958
970
|
|
|
959
971
|
case VLCMediaPlayerStateEnded:
|
|
960
|
-
RCTLogInfo(@"[UnifiedPlayerViewManager] VLCMediaPlayerStateEnded");
|
|
961
|
-
//
|
|
962
|
-
[self sendEvent:@"onPlaybackComplete" body:@{}];
|
|
963
|
-
// Simple loop handling
|
|
972
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] VLCMediaPlayerStateEnded, loop: %@", _loop ? @"YES" : @"NO");
|
|
973
|
+
// Handle looping before sending completion event
|
|
964
974
|
if (_loop) {
|
|
965
|
-
RCTLogInfo(@"[UnifiedPlayerViewManager] Looping video (iOS)");
|
|
966
|
-
|
|
967
|
-
|
|
975
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] Looping video (iOS) - restarting from beginning");
|
|
976
|
+
// Immediately seek to position 0 and play
|
|
977
|
+
// This should work even in Ended state
|
|
978
|
+
[self->_player setPosition:0.0f];
|
|
979
|
+
|
|
980
|
+
// Play immediately after setting position
|
|
981
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
982
|
+
[self->_player play];
|
|
983
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] Restarted playback for loop, state: %d, isPlaying: %@",
|
|
984
|
+
(int)self->_player.state, self->_player.isPlaying ? @"YES" : @"NO");
|
|
985
|
+
});
|
|
986
|
+
} else {
|
|
987
|
+
// Only send completion event if not looping
|
|
988
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] Video ended, sending completion event");
|
|
989
|
+
[self sendEvent:@"onPlaybackComplete" body:@{}];
|
|
968
990
|
}
|
|
969
991
|
break;
|
|
970
992
|
|
|
@@ -1091,7 +1113,9 @@ RCT_CUSTOM_VIEW_PROPERTY(autoplay, BOOL, UnifiedPlayerUIView)
|
|
|
1091
1113
|
// Loop property
|
|
1092
1114
|
RCT_CUSTOM_VIEW_PROPERTY(loop, BOOL, UnifiedPlayerUIView)
|
|
1093
1115
|
{
|
|
1094
|
-
|
|
1116
|
+
BOOL loopValue = [RCTConvert BOOL:json];
|
|
1117
|
+
RCTLogInfo(@"[UnifiedPlayerViewManager] RCT_CUSTOM_VIEW_PROPERTY loop called with json: %@, converted to: %@", json, loopValue ? @"YES" : @"NO");
|
|
1118
|
+
view.loop = loopValue;
|
|
1095
1119
|
}
|
|
1096
1120
|
|
|
1097
1121
|
// Media options property
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-unified-player",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Unified Player",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
39
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
40
40
|
"prepare": "bob build",
|
|
41
|
+
"prepare-publish": "yarn clean && yarn prepare",
|
|
41
42
|
"release": "release-it"
|
|
42
43
|
},
|
|
43
44
|
"keywords": [
|
|
@@ -105,13 +106,16 @@
|
|
|
105
106
|
"release-it": {
|
|
106
107
|
"git": {
|
|
107
108
|
"commitMessage": "chore: release ${version}",
|
|
108
|
-
"tagName": "v${version}"
|
|
109
|
+
"tagName": "v${version}",
|
|
110
|
+
"requireCleanWorkingDir": false
|
|
109
111
|
},
|
|
110
112
|
"npm": {
|
|
111
|
-
"publish": true
|
|
113
|
+
"publish": true,
|
|
114
|
+
"publishPath": "."
|
|
112
115
|
},
|
|
113
116
|
"github": {
|
|
114
|
-
"release": true
|
|
117
|
+
"release": true,
|
|
118
|
+
"autoGenerate": true
|
|
115
119
|
},
|
|
116
120
|
"plugins": {
|
|
117
121
|
"@release-it/conventional-changelog": {
|