@jwplayer/jwplayer-react-native 1.2.0 → 1.3.0

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 (32) hide show
  1. package/README.md +114 -21
  2. package/RNJWPlayer.podspec +1 -1
  3. package/android/build.gradle +14 -1
  4. package/android/src/main/java/com/jwplayer/rnjwplayer/RNJWPlayerModule.java +19 -4
  5. package/android/src/main/java/com/jwplayer/rnjwplayer/RNJWPlayerView.java +270 -105
  6. package/android/src/main/java/com/jwplayer/rnjwplayer/Util.java +13 -1
  7. package/badges/version.svg +1 -1
  8. package/docs/CONFIG-REFERENCE.md +747 -0
  9. package/docs/MIGRATION-GUIDE.md +617 -0
  10. package/docs/PLATFORM-DIFFERENCES.md +693 -0
  11. package/docs/props.md +15 -3
  12. package/index.d.ts +207 -249
  13. package/ios/RNJWPlayer/RNJWPlayerView.swift +278 -21
  14. package/ios/RNJWPlayer/RNJWPlayerViewController.swift +33 -16
  15. package/package.json +2 -2
  16. package/types/advertising.d.ts +514 -0
  17. package/types/index.d.ts +21 -0
  18. package/types/legacy.d.ts +82 -0
  19. package/types/platform-specific.d.ts +641 -0
  20. package/types/playlist.d.ts +410 -0
  21. package/types/unified-config.d.ts +591 -0
  22. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  23. package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
  24. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  25. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  26. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  27. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  28. package/android/.gradle/8.9/gc.properties +0 -0
  29. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  30. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  31. package/android/.gradle/vcs-1/gc.properties +0 -0
  32. package/docs/types.md +0 -254
@@ -0,0 +1,617 @@
1
+ # Migration Guide
2
+
3
+ Guide for migrating to the unified configuration system in JWPlayer React Native.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Breaking Changes](#breaking-changes)
9
+ - [Deprecated Types](#deprecated-types)
10
+ - [Migration Steps](#migration-steps)
11
+ - [Common Migration Patterns](#common-migration-patterns)
12
+ - [Troubleshooting](#troubleshooting)
13
+
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ ### What Changed?
19
+
20
+ The JWPlayer React Native wrapper has been updated with a **unified type system** that provides:
21
+
22
+ - ✅ Single source of truth for types
23
+ - ✅ Better cross-platform consistency
24
+ - ✅ Improved TypeScript support
25
+ - ✅ Clearer platform-specific documentation
26
+ - ✅ More discoverable configuration options
27
+
28
+ ### Is Migration Required?
29
+
30
+ **No!** This is a **non-breaking change**. Your existing code will continue to work.
31
+
32
+ However, we recommend migrating to the new types for:
33
+ - Better TypeScript autocomplete
34
+ - Clearer error messages
35
+ - Future-proof code
36
+ - Access to newly documented features
37
+
38
+ ---
39
+
40
+ ## Breaking Changes
41
+
42
+ ### ❌ NONE
43
+
44
+ This release has **zero breaking changes**. All existing configurations will continue to work as before.
45
+
46
+ ---
47
+
48
+ ## Deprecated Types
49
+
50
+ The following types are deprecated but still functional:
51
+
52
+ ### Type Aliases
53
+
54
+ | Deprecated | Use Instead | Status |
55
+ |------------|-------------|--------|
56
+ | `JwConfig` | `JWPlayerConfig` or `Config` | ⚠️ Deprecated |
57
+ | `JwStretching` | `Stretching` | ⚠️ Deprecated |
58
+ | `JwThumbnailPreview` | `ThumbnailPreview` | ⚠️ Deprecated |
59
+ | `JwAdvertisingConfig` | `JWAdvertisingConfig` | ⚠️ Deprecated |
60
+ | `JwAdRules` | `JWAdRules` | ⚠️ Deprecated |
61
+ | `JwImaSdkSettings` | `JWImaSdkSettings` | ⚠️ Deprecated |
62
+ | `JwImaDaiSettings` | `JWImaDaiSettings` | ⚠️ Deprecated |
63
+ | `JwAdBreak` | `JWAdBreak` | ⚠️ Deprecated |
64
+ | `JwPlaylistItem` | `JWPlaylistItem` | ⚠️ Deprecated |
65
+ | `JwSource` | `JWSource` | ⚠️ Deprecated |
66
+ | `JwTrack` | `JWTrack` | ⚠️ Deprecated |
67
+ | `JwDrm` | `JWDrm` | ⚠️ Deprecated |
68
+ | `JwRelatedConfig` | `JWRelatedConfig` | ⚠️ Deprecated |
69
+ | `JwUiConfig` | `JWUiConfig` | ⚠️ Deprecated |
70
+ | `JwLogoView` | `JWLogoView` | ⚠️ Deprecated |
71
+
72
+ ### Legacy Objects
73
+
74
+ These interfaces from older versions are still supported:
75
+
76
+ | Deprecated | Use Instead |
77
+ |------------|-------------|
78
+ | `Config` (old) | `JWPlayerConfig` |
79
+ | `PlaylistItem` (old) | `JWPlaylistItem` |
80
+ | `Source` (old) | `JWSource` |
81
+ | `Track` (old) | `JWTrack` |
82
+ | `Advertising` (old) | `JWAdvertisingConfig` |
83
+ | `Related` (old) | `JWRelatedConfig` |
84
+ | `Styling` (old) | `JWStyling` |
85
+
86
+ ---
87
+
88
+ ## Migration Steps
89
+
90
+ ### Step 1: Update Imports (Optional)
91
+
92
+ **Before:**
93
+ ```typescript
94
+ import JWPlayer, { JwConfig } from '@jwplayer/jwplayer-react-native';
95
+ ```
96
+
97
+ **After:**
98
+ ```typescript
99
+ import JWPlayer, { JWPlayerConfig } from '@jwplayer/jwplayer-react-native';
100
+ // Or use the Config alias
101
+ import JWPlayer, { Config } from '@jwplayer/jwplayer-react-native';
102
+ ```
103
+
104
+ ### Step 2: Update Type Annotations
105
+
106
+ **Before:**
107
+ ```typescript
108
+ const config: JwConfig = {
109
+ license: 'YOUR_LICENSE',
110
+ file: 'https://example.com/video.m3u8'
111
+ };
112
+ ```
113
+
114
+ **After:**
115
+ ```typescript
116
+ const config: JWPlayerConfig = {
117
+ license: 'YOUR_LICENSE',
118
+ file: 'https://example.com/video.m3u8'
119
+ };
120
+
121
+ // Or use the shorter alias
122
+ const config: Config = {
123
+ license: 'YOUR_LICENSE',
124
+ file: 'https://example.com/video.m3u8'
125
+ };
126
+ ```
127
+
128
+ ### Step 3: Update Field Names (Recommended)
129
+
130
+ **Before (still works):**
131
+ ```typescript
132
+ const config = {
133
+ license: 'YOUR_LICENSE',
134
+ playlist: [{
135
+ file: 'https://example.com/video.m3u8',
136
+ mediaid: 'video-123', // lowercase
137
+ starttime: 10, // lowercase
138
+ adschedule: [...] // lowercase
139
+ }]
140
+ };
141
+ ```
142
+
143
+ **After (recommended):**
144
+ ```typescript
145
+ const config = {
146
+ license: 'YOUR_LICENSE',
147
+ playlist: [{
148
+ file: 'https://example.com/video.m3u8',
149
+ mediaId: 'video-123', // camelCase ✅
150
+ starttime: 10, // or startTime
151
+ adSchedule: [...] // camelCase ✅
152
+ }]
153
+ };
154
+ ```
155
+
156
+ ### Step 4: Standardize Advertising Naming
157
+
158
+ **Before (platform-specific):**
159
+ ```typescript
160
+ // iOS-specific naming
161
+ const iosConfig = {
162
+ advertising: {
163
+ client: 'GoogleIMADAI',
164
+ googimadai: {
165
+ videoID: 'tears-of-steel',
166
+ cmsID: '2528370'
167
+ }
168
+ }
169
+ };
170
+
171
+ // Android-specific naming
172
+ const androidConfig = {
173
+ advertising: {
174
+ client: 'IMA_DAI',
175
+ imaDaiSettings: {
176
+ videoId: 'tears-of-steel',
177
+ cmsId: '2528370'
178
+ }
179
+ }
180
+ };
181
+ ```
182
+
183
+ **After (cross-platform):**
184
+ ```typescript
185
+ const config = {
186
+ advertising: {
187
+ client: 'dai', // Works on both ✅
188
+ imaDaiSettings: { // Preferred naming ✅
189
+ videoId: 'tears-of-steel', // camelCase ✅
190
+ cmsId: '2528370' // camelCase ✅
191
+ }
192
+ }
193
+ };
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Common Migration Patterns
199
+
200
+ ### Pattern 1: Basic Video Config
201
+
202
+ **Before:**
203
+ ```typescript
204
+ import JWPlayer, { JwConfig } from '@jwplayer/jwplayer-react-native';
205
+
206
+ const config: JwConfig = {
207
+ license: 'YOUR_LICENSE',
208
+ file: 'https://example.com/video.m3u8',
209
+ autostart: true
210
+ };
211
+
212
+ export default () => (
213
+ <JWPlayer config={config} style={{ flex: 1 }} />
214
+ );
215
+ ```
216
+
217
+ **After:**
218
+ ```typescript
219
+ import JWPlayer, { Config } from '@jwplayer/jwplayer-react-native';
220
+
221
+ const config: Config = {
222
+ license: 'YOUR_LICENSE',
223
+ file: 'https://example.com/video.m3u8',
224
+ autostart: true
225
+ };
226
+
227
+ export default () => (
228
+ <JWPlayer config={config} style={{ flex: 1 }} />
229
+ );
230
+ ```
231
+
232
+ **Change:** Import `Config` instead of `JwConfig` (or use `JWPlayerConfig`).
233
+
234
+ ### Pattern 2: IMA DAI Configuration
235
+
236
+ **Before:**
237
+ ```typescript
238
+ const config = {
239
+ license: 'YOUR_LICENSE',
240
+ file: 'https://example.com/video.m3u8',
241
+ advertising: {
242
+ cmsID: '2528370',
243
+ videoID: 'tears-of-steel',
244
+ client: 'dai',
245
+ adTagParameters: {
246
+ cust_params: 'section=sports'
247
+ }
248
+ }
249
+ };
250
+ ```
251
+
252
+ **After:**
253
+ ```typescript
254
+ const config: Config = {
255
+ license: 'YOUR_LICENSE',
256
+ file: 'https://example.com/video.m3u8',
257
+ advertising: {
258
+ client: 'dai',
259
+ imaDaiSettings: { // Nested properly ✅
260
+ cmsId: '2528370', // camelCase ✅
261
+ videoId: 'tears-of-steel', // camelCase ✅
262
+ adTagParameters: {
263
+ cust_params: 'section=sports'
264
+ }
265
+ }
266
+ }
267
+ };
268
+ ```
269
+
270
+ **Changes:**
271
+ - Move DAI settings into `imaDaiSettings` object
272
+ - Use camelCase for field names
273
+ - Ensure `client` field is present
274
+
275
+ ### Pattern 3: Playlist with Mixed Content
276
+
277
+ **Before:**
278
+ ```typescript
279
+ const config = {
280
+ license: 'YOUR_LICENSE',
281
+ autostart: true,
282
+ playlist: [
283
+ {
284
+ file: 'https://example.com/video1.m3u8',
285
+ title: 'Video 1',
286
+ imaDaiSettings: {
287
+ videoID: 'video-1',
288
+ cmsID: '12345'
289
+ }
290
+ },
291
+ {
292
+ file: 'https://example.com/video2.m3u8',
293
+ title: 'Video 2'
294
+ }
295
+ ],
296
+ advertising: {
297
+ client: 'dai'
298
+ }
299
+ };
300
+ ```
301
+
302
+ **After:**
303
+ ```typescript
304
+ const config: Config = {
305
+ license: 'YOUR_LICENSE',
306
+ autostart: true,
307
+ playlist: [
308
+ {
309
+ file: 'https://example.com/video1.m3u8',
310
+ title: 'Video 1',
311
+ imaDaiSettings: {
312
+ videoId: 'video-1', // camelCase ✅
313
+ cmsId: '12345' // camelCase ✅
314
+ }
315
+ },
316
+ {
317
+ file: 'https://example.com/video2.m3u8',
318
+ title: 'Video 2'
319
+ }
320
+ ],
321
+ advertising: {
322
+ client: 'dai'
323
+ }
324
+ };
325
+ ```
326
+
327
+ **Changes:**
328
+ - Use camelCase for DAI settings in playlist items
329
+ - Add type annotation for better autocomplete
330
+
331
+ ### Pattern 4: Platform-Specific Features
332
+
333
+ **Before:**
334
+ ```typescript
335
+ const config = {
336
+ license: 'YOUR_LICENSE',
337
+ file: 'https://example.com/video.m3u8',
338
+ styling: { // iOS feature but not documented as such
339
+ colors: {
340
+ buttons: '#FF0000'
341
+ }
342
+ }
343
+ };
344
+ ```
345
+
346
+ **After:**
347
+ ```typescript
348
+ import { Platform } from 'react-native';
349
+ import { Config } from '@jwplayer/jwplayer-react-native';
350
+
351
+ const config: Config = {
352
+ license: 'YOUR_LICENSE',
353
+ file: 'https://example.com/video.m3u8',
354
+
355
+ // Clearly marked as iOS-only
356
+ ...(Platform.OS === 'ios' && {
357
+ styling: { // @platform ios
358
+ colors: {
359
+ buttons: '#FF0000'
360
+ }
361
+ }
362
+ })
363
+ };
364
+ ```
365
+
366
+ **Changes:**
367
+ - Platform-specific features now have `@platform` annotations in types
368
+ - Use conditional spreading for clarity
369
+ - TypeScript will show platform hints in autocomplete
370
+
371
+ ### Pattern 5: Multiple Quality Sources
372
+
373
+ **Before:**
374
+ ```typescript
375
+ const config = {
376
+ license: 'YOUR_LICENSE',
377
+ sources: [
378
+ {
379
+ file: 'https://example.com/1080p.mp4',
380
+ label: '1080p',
381
+ default: 'true' // Wrong type!
382
+ }
383
+ ]
384
+ };
385
+ ```
386
+
387
+ **After:**
388
+ ```typescript
389
+ const config: Config = {
390
+ license: 'YOUR_LICENSE',
391
+ sources: [
392
+ {
393
+ file: 'https://example.com/1080p.mp4',
394
+ label: '1080p',
395
+ default: true // Correct boolean ✅
396
+ }
397
+ ]
398
+ };
399
+ ```
400
+
401
+ **Changes:**
402
+ - TypeScript will now catch type errors
403
+ - `default` must be boolean, not string
404
+
405
+ ---
406
+
407
+ ## Troubleshooting
408
+
409
+ ### Issue: TypeScript Errors After Update
410
+
411
+ **Error:**
412
+ ```
413
+ Property 'googimadai' does not exist on type 'JWAdvertisingConfig'
414
+ ```
415
+
416
+ **Solution:**
417
+
418
+ The type still supports `googimadai` (iOS) and `imaDaiSettings` (Android). You may need to use a type assertion or update to the recommended `imaDaiSettings`:
419
+
420
+ ```typescript
421
+ // Option 1: Use recommended naming
422
+ const config: Config = {
423
+ advertising: {
424
+ client: 'dai',
425
+ imaDaiSettings: { // ✅ Recommended
426
+ videoId: '...',
427
+ cmsId: '...'
428
+ }
429
+ }
430
+ };
431
+
432
+ // Option 2: Type assertion (if you must keep iOS naming)
433
+ const config = {
434
+ advertising: {
435
+ client: 'GoogleIMADAI',
436
+ googimadai: {
437
+ videoID: '...',
438
+ cmsID: '...'
439
+ }
440
+ }
441
+ } as Config;
442
+ ```
443
+
444
+ ### Issue: Import Errors
445
+
446
+ **Error:**
447
+ ```
448
+ Module '@jwplayer/jwplayer-react-native/types' not found
449
+ ```
450
+
451
+ **Solution:**
452
+
453
+ Import from the main package instead:
454
+
455
+ ```typescript
456
+ // ✅ Correct
457
+ import { Config, JWPlayerConfig } from '@jwplayer/jwplayer-react-native';
458
+
459
+ // ❌ Avoid (unless you need internal types)
460
+ import { Config } from '@jwplayer/jwplayer-react-native/types';
461
+ ```
462
+
463
+ ### Issue: Config Type Not Recognized
464
+
465
+ **Problem:** Old `Config` type conflicts with new one.
466
+
467
+ **Solution:**
468
+
469
+ Use the full `JWPlayerConfig` name to avoid conflicts:
470
+
471
+ ```typescript
472
+ import { JWPlayerConfig } from '@jwplayer/jwplayer-react-native';
473
+
474
+ const config: JWPlayerConfig = {
475
+ // ... your config
476
+ };
477
+ ```
478
+
479
+ ### Issue: Platform-Specific Feature Warnings
480
+
481
+ **Warning:** IDE shows "Property 'styling' is iOS-only"
482
+
483
+ **This is expected!** The new types include `@platform` annotations that help you catch platform-specific features.
484
+
485
+ **Solution:**
486
+
487
+ Use platform checks:
488
+
489
+ ```typescript
490
+ import { Platform } from 'react-native';
491
+
492
+ const config: Config = {
493
+ license: 'YOUR_LICENSE',
494
+ file: 'https://example.com/video.m3u8',
495
+
496
+ ...(Platform.OS === 'ios' && {
497
+ styling: { ... }
498
+ }),
499
+
500
+ ...(Platform.OS === 'android' && {
501
+ uiConfig: { ... }
502
+ })
503
+ };
504
+ ```
505
+
506
+ ### Issue: Deprecated Type Warnings
507
+
508
+ **Warning:** `'JwConfig' is deprecated. Use 'Config' or 'JWPlayerConfig' instead`
509
+
510
+ **Solution:**
511
+
512
+ Update the type annotation:
513
+
514
+ ```typescript
515
+ // Before
516
+ const config: JwConfig = { ... };
517
+
518
+ // After
519
+ const config: Config = { ... };
520
+ // or
521
+ const config: JWPlayerConfig = { ... };
522
+ ```
523
+
524
+ These warnings won't affect functionality but should be addressed for future compatibility.
525
+
526
+ ---
527
+
528
+ ## Migration Checklist
529
+
530
+ Use this checklist when migrating your codebase:
531
+
532
+ - [ ] Update type imports from `JwConfig` to `Config` or `JWPlayerConfig`
533
+ - [ ] Standardize field naming to camelCase (mediaId, adSchedule, etc.)
534
+ - [ ] Update IMA DAI configs to use `imaDaiSettings` with camelCase fields
535
+ - [ ] Use cross-platform `client` values ('dai' instead of 'GoogleIMADAI' or 'IMA_DAI')
536
+ - [ ] Add platform checks for iOS/Android-only features
537
+ - [ ] Test configuration on both iOS and Android devices
538
+ - [ ] Update any custom type definitions that extend JWPlayer types
539
+ - [ ] Run TypeScript compiler to catch any type errors
540
+ - [ ] Update documentation/comments referencing old type names
541
+
542
+ ---
543
+
544
+ ## Benefits of Migration
545
+
546
+ ### Before Migration
547
+
548
+ ```typescript
549
+ // Old code - still works but less optimal
550
+ const config = {
551
+ license: 'LICENSE',
552
+ file: 'video.m3u8',
553
+ advertising: {
554
+ cmsID: '123', // Direct on advertising object
555
+ videoID: 'abc',
556
+ client: 'GoogleIMADAI' // Platform-specific
557
+ }
558
+ };
559
+ ```
560
+
561
+ **Issues:**
562
+ - ❌ No TypeScript autocomplete for DAI settings
563
+ - ❌ Platform-specific naming reduces portability
564
+ - ❌ Unclear structure (flat vs nested)
565
+ - ❌ IDE doesn't show available options
566
+
567
+ ### After Migration
568
+
569
+ ```typescript
570
+ // New code - recommended
571
+ const config: Config = {
572
+ license: 'LICENSE',
573
+ file: 'video.m3u8',
574
+ advertising: {
575
+ client: 'dai', // Cross-platform ✅
576
+ imaDaiSettings: { // Clearly structured ✅
577
+ cmsId: '123', // camelCase ✅
578
+ videoId: 'abc' // camelCase ✅
579
+ }
580
+ }
581
+ };
582
+ ```
583
+
584
+ **Benefits:**
585
+ - ✅ Full TypeScript autocomplete
586
+ - ✅ Cross-platform compatibility
587
+ - ✅ Clear structure and organization
588
+ - ✅ IDE shows all available options
589
+ - ✅ Platform-specific features clearly marked
590
+ - ✅ Better error messages
591
+
592
+ ---
593
+
594
+ ## Need Help?
595
+
596
+ - **General Config Questions**: See [CONFIG-REFERENCE.md](./CONFIG-REFERENCE.md)
597
+ - **Platform Differences**: Check [PLATFORM-DIFFERENCES.md](./PLATFORM-DIFFERENCES.md)
598
+ - **Type Definitions**: Review `types/` directory
599
+ - **Examples**: Check `Example/app/jsx/screens/` for updated examples
600
+
601
+ ---
602
+
603
+ ## Summary
604
+
605
+ - **No Breaking Changes**: Your existing code continues to work
606
+ - **Optional Migration**: Migrate at your own pace
607
+ - **Better Types**: New unified types provide better developer experience
608
+ - **Clear Documentation**: Platform-specific features are clearly marked
609
+ - **Future-Proof**: Prepared for future SDK updates
610
+
611
+ We recommend migrating incrementally, starting with new features and gradually updating existing configurations as you maintain your codebase.
612
+
613
+ ---
614
+
615
+ *Last Updated: October 2025*
616
+ *SDK Version: JWPlayer React Native*
617
+