react-native-unified-player 0.5.5 → 0.5.6

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.
@@ -23,10 +23,5 @@ else
23
23
  s.dependency "React-Core"
24
24
  end
25
25
 
26
- # Add MobileVLCKit dependency with exact version to avoid compatibility issues
27
- s.dependency "MobileVLCKit", "3.3.17"
28
-
29
- # Disable bitcode to match VLC requirements
30
- s.pod_target_xcconfig = { "ENABLE_BITCODE" => "NO" }
31
- s.user_target_xcconfig = { "ENABLE_BITCODE" => "NO" }
26
+ # AVFoundation is part of iOS SDK, no external dependency needed
32
27
  end
@@ -1,6 +1,6 @@
1
1
  #import <React/RCTEventEmitter.h>
2
2
  #import <React/RCTBridgeModule.h>
3
- #import <MobileVLCKit/MobileVLCKit.h> // Import MobileVLCKit
3
+ #import <AVFoundation/AVFoundation.h> // Import MobileVLCKit
4
4
 
5
5
  // Forward declaration for UnifiedPlayerUIView
6
6
  @class UnifiedPlayerUIView;
@@ -4,7 +4,7 @@
4
4
  #import <React/RCTBridgeModule.h>
5
5
  #import <React/RCTEventEmitter.h>
6
6
  #import <React/RCTUIManager.h>
7
- #import <MobileVLCKit/MobileVLCKit.h>
7
+ #import <AVFoundation/AVFoundation.h>
8
8
 
9
9
  @implementation UnifiedPlayerModule
10
10
 
@@ -59,9 +59,9 @@ RCT_EXPORT_METHOD(play:(nonnull NSNumber *)reactTag
59
59
  resolver:(RCTPromiseResolveBlock)resolve
60
60
  rejecter:(RCTPromiseRejectBlock)reject) {
61
61
  [self executeWithPlayerView:reactTag resolver:resolve rejecter:reject block:^(UnifiedPlayerUIView *playerView) {
62
- VLCMediaPlayer *player = [playerView valueForKey:@"player"];
63
- if (player && player.media) {
64
- [player play];
62
+ AVPlayer *player = playerView.player;
63
+ if (player && playerView.playerItem) {
64
+ [playerView play];
65
65
  resolve(@(YES));
66
66
  } else {
67
67
  reject(@"E_PLAYER_ERROR", @"Player or media not initialized", nil);
@@ -73,9 +73,9 @@ RCT_EXPORT_METHOD(pause:(nonnull NSNumber *)reactTag
73
73
  resolver:(RCTPromiseResolveBlock)resolve
74
74
  rejecter:(RCTPromiseRejectBlock)reject) {
75
75
  [self executeWithPlayerView:reactTag resolver:resolve rejecter:reject block:^(UnifiedPlayerUIView *playerView) {
76
- VLCMediaPlayer *player = [playerView valueForKey:@"player"];
76
+ AVPlayer *player = playerView.player;
77
77
  if (player) {
78
- [player pause];
78
+ [playerView pause];
79
79
  resolve(@(YES));
80
80
  } else {
81
81
  reject(@"E_PLAYER_ERROR", @"Player not initialized", nil);
@@ -88,13 +88,8 @@ RCT_EXPORT_METHOD(seekTo:(nonnull NSNumber *)reactTag
88
88
  resolver:(RCTPromiseResolveBlock)resolve
89
89
  rejecter:(RCTPromiseRejectBlock)reject) {
90
90
  [self executeWithPlayerView:reactTag resolver:resolve rejecter:reject block:^(UnifiedPlayerUIView *playerView) {
91
- VLCMediaPlayer *player = [playerView valueForKey:@"player"];
92
- if (player && player.media) {
93
- float timeValue = [time floatValue];
94
- float duration = player.media.length.intValue / 1000.0f;
95
- float position = duration > 0 ? timeValue / duration : 0;
96
- position = MAX(0, MIN(1, position));
97
- [player setPosition:position];
91
+ if (playerView.player && playerView.playerItem) {
92
+ [playerView seekToTime:time];
98
93
  resolve(@(YES));
99
94
  } else {
100
95
  reject(@"E_PLAYER_ERROR", @"Player or media not initialized", nil);
@@ -108,13 +103,8 @@ RCT_EXPORT_METHOD(getCurrentTime:(nonnull NSNumber *)reactTag
108
103
  resolver:(RCTPromiseResolveBlock)resolve
109
104
  rejecter:(RCTPromiseRejectBlock)reject) {
110
105
  [self executeWithPlayerView:reactTag resolver:resolve rejecter:reject block:^(UnifiedPlayerUIView *playerView) {
111
- VLCMediaPlayer *player = [playerView valueForKey:@"player"];
112
- if (player) {
113
- float currentTime = player.time.intValue / 1000.0f;
114
- resolve(@(currentTime));
115
- } else {
116
- reject(@"E_PLAYER_ERROR", @"Player not initialized", nil);
117
- }
106
+ float currentTime = [playerView getCurrentTime];
107
+ resolve(@(currentTime));
118
108
  }];
119
109
  }
120
110
 
@@ -1,24 +1,32 @@
1
1
  #import <UIKit/UIKit.h>
2
2
  #import <React/RCTView.h>
3
3
  #import <React/RCTComponent.h>
4
- #import <MobileVLCKit/MobileVLCKit.h>
4
+ #import <React/RCTBridge.h>
5
+ #import <React/RCTViewManager.h>
5
6
  #import <AVFoundation/AVFoundation.h>
6
7
  #import <CoreVideo/CoreVideo.h>
7
8
 
8
9
  NS_ASSUME_NONNULL_BEGIN
9
10
 
10
- @interface UnifiedPlayerUIView : UIView <VLCMediaPlayerDelegate>
11
+ @class AVPlayer;
12
+ @class AVPlayerLayer;
13
+ @class AVPlayerItem;
11
14
 
12
- @property (nonatomic, strong) VLCMediaPlayer *player;
15
+ @interface UnifiedPlayerUIView : UIView
16
+
17
+ @property (nonatomic, strong) AVPlayer *player;
18
+ @property (nonatomic, strong) AVPlayerLayer *playerLayer;
19
+ @property (nonatomic, strong, nullable) AVPlayerItem *playerItem;
20
+ @property (nonatomic, strong, nullable) id timeObserverToken;
13
21
  @property (nonatomic, copy, nullable) NSString *videoUrlString;
14
22
  @property (nonatomic, copy, nullable) NSString *thumbnailUrlString;
15
23
  @property (nonatomic, assign) BOOL autoplay;
16
24
  @property (nonatomic, assign) BOOL loop;
25
+ @property (nonatomic, assign) float speed;
17
26
  @property (nonatomic, assign) BOOL isPaused;
18
27
  @property (nonatomic, assign) BOOL isFullscreen;
19
28
  @property (nonatomic, strong) NSArray *mediaOptions;
20
29
  @property (nonatomic, weak) RCTBridge *bridge;
21
- @property (nonatomic, assign) VLCMediaPlayerState previousState;
22
30
  @property (nonatomic, assign) BOOL hasRenderedVideo;
23
31
  @property (nonatomic, assign) BOOL readyEventSent;
24
32
  @property (nonatomic, assign) BOOL isRecording;
@@ -26,7 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
26
34
  @property (nonatomic, strong) AVAssetWriterInput *assetWriterVideoInput;
27
35
  @property (nonatomic, strong) AVAssetWriterInputPixelBufferAdaptor *assetWriterPixelBufferAdaptor;
28
36
  @property (nonatomic, strong) NSString *recordingPath;
29
- // We'll use associated objects instead of a property for CADisplayLink
30
37
  @property (nonatomic, assign) NSInteger frameCount;
31
38
 
32
39
  // Event callbacks
@@ -56,6 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
56
63
  - (void)startFrameCapture;
57
64
  - (NSString *)stopRecording;
58
65
  - (void)setSpeed:(float)speed;
66
+ - (void)setLoop:(BOOL)loop;
59
67
 
60
68
  @end
61
69