react-native-unified-player 0.2.1 β†’ 0.2.3

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.
Files changed (2) hide show
  1. package/README.md +151 -60
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,94 +1,185 @@
1
- # react-native-unified-player
1
+ # React Native Your Unified Player
2
2
 
3
- Unified Player with VLC integration for enhanced codec and streaming protocol support.
3
+ A powerful React Native component that provides a unified interface for playing both MP4 videos and WebRTC streams. Built with Fabric and the new React Native architecture.
4
+
5
+ ## Features
6
+
7
+ - πŸŽ₯ Support for MP4 video playback
8
+ - 🌐 WebRTC streaming capabilities
9
+ - πŸ”„ Unified interface for both video types
10
+ - πŸ“± Native performance with Fabric architecture
11
+ - πŸŽ›οΈ Comprehensive playback controls
12
+ - πŸ“Š Event handling for player states
13
+ - πŸ” Support for different resize modes
14
+ - 🎚️ Volume and mute controls
15
+ - ⏯️ Play/pause functionality
4
16
 
5
17
  ## Installation
6
18
 
7
- ```sh
8
- npm install react-native-unified-player
19
+ ```bash
20
+ yarn add react-native-your-unified-player
9
21
  ```
10
22
 
11
- ### iOS Setup for VLC
23
+ or
12
24
 
13
- The iOS version of this player uses MobileVLCKit for advanced video playback capabilities. It supports a wide range of formats including RTSP, RTMP, HLS, and other protocols supported by VLC.
25
+ ```bash
26
+ npm install react-native-your-unified-player
27
+ ```
14
28
 
15
- The VLC dependencies are automatically installed via CocoaPods through the podspec file. After installing the package:
29
+ ## Usage
16
30
 
17
- 1. Navigate to the iOS folder of your project:
18
- ```sh
19
- cd ios
20
- ```
31
+ ### Basic Usage
32
+
33
+ ```jsx
34
+ import { YourUnifiedPlayerView } from 'react-native-your-unified-player';
35
+
36
+ // For MP4 video
37
+ <YourUnifiedPlayerView
38
+ source={{
39
+ type: 'url',
40
+ uri: 'https://example.com/video.mp4'
41
+ }}
42
+ style={{ width: '100%', height: 300 }}
43
+ paused={false}
44
+ muted={false}
45
+ volume={1.0}
46
+ resizeMode="contain"
47
+ onUrlLoad={({ duration, naturalSize }) => {
48
+ console.log('Video loaded:', duration, naturalSize);
49
+ }}
50
+ onError={({ error, code }) => {
51
+ console.error('Player error:', error, code);
52
+ }}
53
+ />
21
54
 
22
- 2. Install pods:
23
- ```sh
24
- pod install
25
- ```
55
+ // For WebRTC stream
56
+ <YourUnifiedPlayerView
57
+ source={{
58
+ type: 'webrtc',
59
+ signalingUrl: 'wss://example.com/signaling',
60
+ iceServers: [
61
+ { urls: 'stun:stun.l.google.com:19302' }
62
+ ]
63
+ }}
64
+ style={{ width: '100%', height: 300 }}
65
+ onWebRTCConnected={({ connectionInfo }) => {
66
+ console.log('WebRTC connected:', connectionInfo);
67
+ }}
68
+ onWebRTCDisconnected={({ code, reason }) => {
69
+ console.log('WebRTC disconnected:', code, reason);
70
+ }}
71
+ />
72
+ ```
26
73
 
27
- 3. VLC requires "Bitcode" to be disabled in your Xcode project. This is handled automatically in the podspec file, but if you experience issues, check that your project's Build Settings have "Enable Bitcode" set to "No".
74
+ ### Props
28
75
 
29
- 4. Starting from iOS 14, you need to provide a message for the `NSLocalNetworkUsageDescription` key in your `Info.plist` if you're using external streaming sources. Add something like:
30
- ```xml
31
- <key>NSLocalNetworkUsageDescription</key>
32
- <string>This app requires access to the local network to stream media content</string>
33
- ```
76
+ #### Common Props
34
77
 
35
- ### Troubleshooting VLC Integration
78
+ | Prop | Type | Default | Description |
79
+ |------|------|---------|-------------|
80
+ | `paused` | `boolean` | `false` | Controls playback state |
81
+ | `muted` | `boolean` | `false` | Controls audio mute state |
82
+ | `volume` | `number` | `1.0` | Controls audio volume (0.0 to 1.0) |
83
+ | `resizeMode` | `'contain' \| 'cover' \| 'stretch'` | `'contain'` | Controls how the video fits in the view |
36
84
 
37
- If you encounter build issues with VLC:
85
+ #### Source Props
38
86
 
39
- 1. **Compilation Errors**: If you see errors about missing properties or methods, it might be because the VLC API has changed. This package uses MobileVLCKit 3.3.17, which is compatible with the current implementation.
87
+ For MP4 videos:
88
+ ```typescript
89
+ {
90
+ type: 'url';
91
+ uri: string;
92
+ }
93
+ ```
40
94
 
41
- 2. **Playback Issues on iOS 14+**: VLC has known issues with certain RTSP streams on iOS 14. If you experience a black screen or playback failures specifically on newer iOS devices, try the following:
42
- - Add additional media options in your code:
43
- ```js
44
- // Example: Adding network caching for better buffering
45
- <UnifiedPlayerView
46
- videoUrl="rtsp://example.com/stream"
47
- mediaOptions={["--network-caching=1500", "--live-caching=1500"]}
48
- />
49
- ```
95
+ For WebRTC streams:
96
+ ```typescript
97
+ {
98
+ type: 'webrtc';
99
+ signalingUrl: string;
100
+ streamConfig?: object;
101
+ iceServers?: ReadonlyArray<{ urls: string | ReadonlyArray<string> }>;
102
+ }
103
+ }
104
+ ```
50
105
 
51
- 3. **Link Required Frameworks**: Make sure you have all required frameworks linked in your Xcode project:
52
- - AudioToolbox.framework
53
- - AVFoundation.framework
54
- - CoreMedia.framework
55
- - CoreVideo.framework
56
- - libc++.tbd
57
- - libiconv.tbd
58
- - libz.tbd
106
+ ### Events
59
107
 
60
- ## Usage
108
+ #### URL Events
109
+ - `onUrlLoad`: Fired when the video is loaded
110
+ - `onUrlProgress`: Fired during video playback
111
+ - `onUrlEnd`: Fired when video playback ends
112
+ - `onUrlReadyForDisplay`: Fired when the video is ready to display
61
113
 
62
- ```js
63
- import { UnifiedPlayerView } from "react-native-unified-player";
114
+ #### WebRTC Events
115
+ - `onWebRTCConnected`: Fired when WebRTC connection is established
116
+ - `onWebRTCDisconnected`: Fired when WebRTC connection is lost
117
+ - `onWebRTCStats`: Fired with WebRTC connection statistics
64
118
 
65
- // ...
119
+ #### Common Events
120
+ - `onError`: Fired when an error occurs
66
121
 
67
- <UnifiedPlayerView
68
- videoUrl="https://example.com/video.mp4"
69
- autoplay={true}
70
- loop={false}
71
- authToken="optional-auth-token"
72
- />
122
+ ### Commands
123
+
124
+ The component supports the following commands:
125
+
126
+ ```typescript
127
+ // Seek to a specific time in the video
128
+ seekUrl(viewRef: React.RefObject<YourUnifiedPlayerView>, timeSeconds: number): void;
129
+
130
+ // Send a message through WebRTC data channel
131
+ sendWebRTCMessage(viewRef: React.RefObject<YourUnifiedPlayerView>, message: string): void;
73
132
  ```
74
133
 
75
- ### Supported Formats
134
+ ## Development
135
+
136
+ ### Prerequisites
137
+
138
+ - Node.js >= 16
139
+ - Yarn >= 1.22
140
+ - React Native >= 0.79.0
141
+ - iOS: Xcode >= 14.0
142
+ - Android: Android Studio >= 2022.3
143
+
144
+ ### Setup
145
+
146
+ 1. Clone the repository
147
+ 2. Install dependencies:
148
+ ```bash
149
+ yarn install
150
+ ```
151
+ 3. Build the project:
152
+ ```bash
153
+ yarn prepare
154
+ ```
76
155
 
77
- With VLC integration, the player supports a wide range of formats:
156
+ ### Running the Example App
78
157
 
79
- - Network streams: RTSP, RTP, RTMP, HLS, MMS
80
- - Container formats: MP4, MKV, AVI, FLV, MOV, TS, and many more
81
- - Codec support: H.264, H.265, VP8, VP9, and many others
82
- - Audio: Multiple audio tracks support including 5.1
83
- - Subtitles: Support for various subtitle formats including SSA
158
+ 1. Navigate to the example directory:
159
+ ```bash
160
+ cd example
161
+ ```
162
+ 2. Install dependencies:
163
+ ```bash
164
+ yarn install
165
+ ```
166
+ 3. Run the app:
167
+ ```bash
168
+ yarn ios # for iOS
169
+ yarn android # for Android
170
+ ```
84
171
 
85
172
  ## Contributing
86
173
 
87
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
174
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
88
175
 
89
176
  ## License
90
177
 
91
- MIT
178
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
179
+
180
+ ## Author
181
+
182
+ Yaşar Γ–zyurt ([@blueromans](https://github.com/blueromans))
92
183
 
93
184
  ---
94
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unified-player",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Unified Player",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",