@capgo/capacitor-video-player 8.1.23 → 8.1.25

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
@@ -152,6 +152,8 @@ Picture in Picture on Android requires your app activity to declare PiP support
152
152
  * [`showController()`](#showcontroller)
153
153
  * [`isControllerIsFullyVisible()`](#iscontrollerisfullyvisible)
154
154
  * [`exitPlayer()`](#exitplayer)
155
+ * [`hidePlayer()`](#hideplayer)
156
+ * [`showPlayer()`](#showplayer)
155
157
  * [Interfaces](#interfaces)
156
158
 
157
159
  </docgen-index>
@@ -432,6 +434,34 @@ Exit player
432
434
  --------------------
433
435
 
434
436
 
437
+ ### hidePlayer()
438
+
439
+ ```typescript
440
+ hidePlayer() => Promise<capVideoPlayerResult>
441
+ ```
442
+
443
+ Hide the currently presented player UI without stopping playback (native fullscreen).
444
+
445
+ Call `showPlayer()` to show it again.
446
+
447
+ **Returns:** <code>Promise&lt;<a href="#capvideoplayerresult">capVideoPlayerResult</a>&gt;</code>
448
+
449
+ --------------------
450
+
451
+
452
+ ### showPlayer()
453
+
454
+ ```typescript
455
+ showPlayer() => Promise<capVideoPlayerResult>
456
+ ```
457
+
458
+ Show again a previously hidden player UI (native fullscreen).
459
+
460
+ **Returns:** <code>Promise&lt;<a href="#capvideoplayerresult">capVideoPlayerResult</a>&gt;</code>
461
+
462
+ --------------------
463
+
464
+
435
465
  ### Interfaces
436
466
 
437
467
 
@@ -447,31 +477,33 @@ Exit player
447
477
 
448
478
  #### capVideoPlayerOptions
449
479
 
450
- | Prop | Type | Description |
451
- | --------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
452
- | **`mode`** | <code>string</code> | Player mode - "fullscreen" - "embedded" (Web only) |
453
- | **`url`** | <code>string</code> | The url of the video to play |
454
- | **`subtitle`** | <code>string</code> | The url of subtitle associated with the video |
455
- | **`language`** | <code>string</code> | The language of subtitle see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers |
456
- | **`subtitleOptions`** | <code><a href="#subtitleoptions">SubTitleOptions</a></code> | SubTitle Options |
457
- | **`playerId`** | <code>string</code> | Id of DIV Element parent of the player |
458
- | **`rate`** | <code>number</code> | Initial playing rate |
459
- | **`exitOnEnd`** | <code>boolean</code> | Exit on VideoEnd (iOS, Android) default: true |
460
- | **`loopOnEnd`** | <code>boolean</code> | Loop on VideoEnd when exitOnEnd false (iOS, Android) default: false |
461
- | **`pipEnabled`** | <code>boolean</code> | Picture in Picture Enable (iOS, Android) default: true |
462
- | **`bkmodeEnabled`** | <code>boolean</code> | Background Mode Enable (iOS, Android) default: true |
463
- | **`showControls`** | <code>boolean</code> | Show Controls Enable (iOS, Android) default: true |
464
- | **`displayMode`** | <code>string</code> | Display Mode ["all", "portrait", "landscape"] (iOS, Android) default: "all" |
465
- | **`componentTag`** | <code>string</code> | Component Tag or DOM Element Tag (React app) |
466
- | **`width`** | <code>number</code> | Player Width (mode "embedded" only) |
467
- | **`height`** | <code>number</code> | Player height (mode "embedded" only) |
468
- | **`headers`** | <code>{ [key: string]: string; }</code> | Headers for the request (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
469
- | **`title`** | <code>string</code> | Title shown in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
470
- | **`smallTitle`** | <code>string</code> | Subtitle shown below the title in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
471
- | **`accentColor`** | <code>string</code> | ExoPlayer Progress Bar and Spinner color (Android) by Manuel García Marín (https://github.com/PhantomPainX) Must be a valid hex color code default: #FFFFFF |
472
- | **`chromecast`** | <code>boolean</code> | Chromecast enable/disable (iOS, Android) iOS requires Google Cast SDK setup and local network Info.plist keys. by Manuel García Marín (https://github.com/PhantomPainX) default: true |
473
- | **`artwork`** | <code>string</code> | Artwork url to be shown in Chromecast player (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) default: "" |
474
- | **`drm`** | <code><a href="#drmoptions">DrmOptions</a></code> | DRM configuration for protected content (iOS: FairPlay, Android: Widevine) |
480
+ | Prop | Type | Description |
481
+ | --------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
482
+ | **`mode`** | <code>string</code> | Player mode - "fullscreen" - "embedded" (Web only) |
483
+ | **`url`** | <code>string</code> | The url of the video to play |
484
+ | **`chromecastUrl`** | <code>string</code> | Optional override URL used when casting to Chromecast (iOS, Android). This lets you cast an alternative rendition/manifest (e.g. MPEG-DASH + Widevine) while keeping the on-device playback URL unchanged (e.g. HLS + FairPlay on iOS). |
485
+ | **`subtitle`** | <code>string</code> | The url of subtitle associated with the video |
486
+ | **`language`** | <code>string</code> | The language of subtitle see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers |
487
+ | **`subtitleOptions`** | <code><a href="#subtitleoptions">SubTitleOptions</a></code> | SubTitle Options |
488
+ | **`playerId`** | <code>string</code> | Id of DIV Element parent of the player |
489
+ | **`rate`** | <code>number</code> | Initial playing rate |
490
+ | **`exitOnEnd`** | <code>boolean</code> | Exit on VideoEnd (iOS, Android) default: true |
491
+ | **`loopOnEnd`** | <code>boolean</code> | Loop on VideoEnd when exitOnEnd false (iOS, Android) default: false |
492
+ | **`pipEnabled`** | <code>boolean</code> | Picture in Picture Enable (iOS, Android) default: true |
493
+ | **`bkmodeEnabled`** | <code>boolean</code> | Background Mode Enable (iOS, Android) default: true |
494
+ | **`audioCategory`** | <code>'ambient' \| 'playback' \| 'moviePlayback'</code> | iOS audio session category behavior (iOS). - "ambient": respects the iPhone silent switch (default) - "playback": ignores the iPhone silent switch - "moviePlayback": playback optimized for video and long-form AirPlay default: "ambient" |
495
+ | **`showControls`** | <code>boolean</code> | Show Controls Enable (iOS, Android) default: true |
496
+ | **`displayMode`** | <code>string</code> | Display Mode ["all", "portrait", "landscape"] (iOS, Android) default: "all" |
497
+ | **`componentTag`** | <code>string</code> | Component Tag or DOM Element Tag (React app) |
498
+ | **`width`** | <code>number</code> | Player Width (mode "embedded" only) |
499
+ | **`height`** | <code>number</code> | Player height (mode "embedded" only) |
500
+ | **`headers`** | <code>{ [key: string]: string; }</code> | Headers for the request (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
501
+ | **`title`** | <code>string</code> | Title shown in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
502
+ | **`smallTitle`** | <code>string</code> | Subtitle shown below the title in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) |
503
+ | **`accentColor`** | <code>string</code> | ExoPlayer Progress Bar and Spinner color (Android) by Manuel García Marín (https://github.com/PhantomPainX) Must be a valid hex color code default: #FFFFFF |
504
+ | **`chromecast`** | <code>boolean</code> | Chromecast enable/disable (iOS, Android) iOS requires Google Cast SDK setup and local network Info.plist keys. by Manuel García Marín (https://github.com/PhantomPainX) default: true |
505
+ | **`artwork`** | <code>string</code> | Artwork url to be shown in Chromecast player (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) default: "" |
506
+ | **`drm`** | <code><a href="#drmoptions">DrmOptions</a></code> | DRM configuration for protected content (iOS: FairPlay, Android: Widevine) When casting, Widevine's `certificateUrl` (license URL) is also forwarded to Chromecast receivers as `media.customData.laurl`. |
475
507
 
476
508
 
477
509
  #### SubTitleOptions
@@ -498,10 +530,11 @@ Exit player
498
530
 
499
531
  #### FairPlayDrmOptions
500
532
 
501
- | Prop | Type | Description |
502
- | ---------------------- | ------------------- | --------------------------------------------------------------------------------- |
503
- | **`certificateUrl`** | <code>string</code> | The URL to fetch the FairPlay certificate |
504
- | **`contentKeySpcUrl`** | <code>string</code> | The URL to send the SPC and receive the CKC license (FairPlay license server URL) |
533
+ | Prop | Type | Description |
534
+ | ---------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
535
+ | **`certificateUrl`** | <code>string</code> | The URL to fetch the FairPlay certificate |
536
+ | **`contentKeySpcUrl`** | <code>string</code> | The URL to send the SPC and receive the CKC license (FairPlay license server URL) |
537
+ | **`assetId`** | <code>string</code> | Optional FairPlay asset identifier used when generating the SPC. Defaults to the `skd://` content identifier from the key request. |
505
538
 
506
539
 
507
540
  #### PlayreadyDrmOptions
@@ -55,6 +55,7 @@ import com.google.android.exoplayer2.MediaItem;
55
55
  import com.google.android.exoplayer2.MediaMetadata;
56
56
  import com.google.android.exoplayer2.PlaybackParameters;
57
57
  import com.google.android.exoplayer2.Player;
58
+ import com.google.android.exoplayer2.Tracks;
58
59
  import com.google.android.exoplayer2.audio.AudioAttributes;
59
60
  import com.google.android.exoplayer2.ext.cast.CastPlayer;
60
61
  import com.google.android.exoplayer2.ext.cast.DefaultMediaItemConverter;
@@ -110,6 +111,7 @@ import org.json.JSONObject;
110
111
  public class FullscreenExoPlayerFragment extends Fragment {
111
112
 
112
113
  public String videoPath;
114
+ public String chromecastUrl;
113
115
  public Float videoRate;
114
116
  public String playerId;
115
117
  public String subTitle;
@@ -322,6 +324,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
322
324
  }
323
325
  linearLayout.setVisibility(View.INVISIBLE);
324
326
  Log.v(TAG, "**** in ExoPlayer.STATE_READY firstReadyToPlay " + firstReadyToPlay);
327
+ updateSubtitleButtonVisibility(player.getCurrentTracks());
325
328
 
326
329
  if (firstReadyToPlay) {
327
330
  firstReadyToPlay = false;
@@ -381,6 +384,11 @@ public class FullscreenExoPlayerFragment extends Fragment {
381
384
  break;
382
385
  }
383
386
  }
387
+
388
+ @Override
389
+ public void onTracksChanged(Tracks tracks) {
390
+ updateSubtitleButtonVisibility(tracks);
391
+ }
384
392
  };
385
393
 
386
394
  if (isTV) {
@@ -877,6 +885,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
877
885
  }
878
886
 
879
887
  styledPlayerView.setPlayer(player);
888
+ updateSubtitleButtonVisibility(player.getCurrentTracks());
880
889
 
881
890
  MediaSource mediaSource;
882
891
  if (!isInternal) {
@@ -917,6 +926,26 @@ public class FullscreenExoPlayerFragment extends Fragment {
917
926
  NotificationCenter.defaultCenter().postNotification("initializePlayer", info);
918
927
  }
919
928
 
929
+ private void updateSubtitleButtonVisibility(Tracks tracks) {
930
+ if (styledPlayerView == null) return;
931
+ if (sturi != null) {
932
+ styledPlayerView.setShowSubtitleButton(true);
933
+ return;
934
+ }
935
+ styledPlayerView.setShowSubtitleButton(hasSupportedTextTrack(tracks));
936
+ }
937
+
938
+ private boolean hasSupportedTextTrack(Tracks tracks) {
939
+ if (tracks == null) return false;
940
+ for (Tracks.Group group : tracks.getGroups()) {
941
+ if (group.getType() != C.TRACK_TYPE_TEXT) continue;
942
+ for (int i = 0; i < group.length; i++) {
943
+ if (group.isTrackSupported(i)) return true;
944
+ }
945
+ }
946
+ return false;
947
+ }
948
+
920
949
  private void setSubtitle(boolean transparent) {
921
950
  int foreground;
922
951
  int background;
@@ -1527,6 +1556,9 @@ public class FullscreenExoPlayerFragment extends Fragment {
1527
1556
  private final class EmptyCallback extends MediaRouter.Callback {}
1528
1557
 
1529
1558
  private Uri getCastUri() {
1559
+ if (chromecastUrl != null && !chromecastUrl.isEmpty()) {
1560
+ return Uri.parse(chromecastUrl);
1561
+ }
1530
1562
  return uri != null ? uri : Uri.parse(videoPath);
1531
1563
  }
1532
1564
 
@@ -1603,6 +1635,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
1603
1635
 
1604
1636
  private static final String KEY_MEDIA_ITEM = "mediaItem";
1605
1637
  private static final String KEY_PLAYER_CONFIG = "exoPlayerConfig";
1638
+ private static final String KEY_WIDEVINE_LICENSE_URL = "laurl";
1606
1639
  private static final String KEY_MEDIA_ID = "mediaId";
1607
1640
  private static final String KEY_URI = "uri";
1608
1641
  private static final String KEY_TITLE = "title";
@@ -1721,6 +1754,11 @@ public class FullscreenExoPlayerFragment extends Fragment {
1721
1754
  if (playerConfig != null) {
1722
1755
  customData.put(KEY_PLAYER_CONFIG, playerConfig);
1723
1756
  }
1757
+ MediaItem.LocalConfiguration localConfiguration = mediaItem.localConfiguration;
1758
+ MediaItem.DrmConfiguration drmConfiguration = localConfiguration != null ? localConfiguration.drmConfiguration : null;
1759
+ if (drmConfiguration != null && C.WIDEVINE_UUID.equals(drmConfiguration.scheme) && drmConfiguration.licenseUri != null) {
1760
+ customData.put(KEY_WIDEVINE_LICENSE_URL, drmConfiguration.licenseUri.toString());
1761
+ }
1724
1762
  return customData;
1725
1763
  } catch (JSONException e) {
1726
1764
  throw new RuntimeException(e);
@@ -14,6 +14,7 @@ public class VideoPlayer {
14
14
 
15
15
  public FullscreenExoPlayerFragment createFullScreenFragment(
16
16
  String videoPath,
17
+ String chromecastUrl,
17
18
  Float videoRate,
18
19
  Boolean exitOnEnd,
19
20
  Boolean loopOnEnd,
@@ -39,6 +40,7 @@ public class VideoPlayer {
39
40
  FullscreenExoPlayerFragment fsFragment = new FullscreenExoPlayerFragment();
40
41
 
41
42
  fsFragment.videoPath = videoPath;
43
+ fsFragment.chromecastUrl = chromecastUrl;
42
44
  fsFragment.videoRate = videoRate;
43
45
  fsFragment.exitOnEnd = exitOnEnd;
44
46
  fsFragment.loopOnEnd = loopOnEnd;
@@ -9,7 +9,9 @@ import android.content.res.Configuration;
9
9
  import android.content.res.Configuration;
10
10
  import android.os.Build;
11
11
  import android.util.Log;
12
+ import android.view.View;
12
13
  import android.view.ViewGroup;
14
+ import android.view.WindowManager;
13
15
  import android.widget.FrameLayout;
14
16
  import android.widget.Toast;
15
17
  import androidx.fragment.app.Fragment;
@@ -39,7 +41,7 @@ import java.util.Map;
39
41
  )
40
42
  public class VideoPlayerPlugin extends Plugin {
41
43
 
42
- private final String pluginVersion = "8.1.23";
44
+ private final String pluginVersion = "8.1.25";
43
45
 
44
46
  // Permission alias constants
45
47
  private static final String PERMISSION_DENIED_ERROR = "Unable to access media videos, user denied permission request";
@@ -78,6 +80,7 @@ public class VideoPlayerPlugin extends Plugin {
78
80
  private Boolean chromecast = true;
79
81
  private String artwork;
80
82
  private String url;
83
+ private String chromecastUrl;
81
84
  private String playerId;
82
85
  private String subtitle = "";
83
86
  private String language = "";
@@ -187,6 +190,11 @@ public class VideoPlayerPlugin extends Plugin {
187
190
  call.resolve(ret);
188
191
  return;
189
192
  }
193
+ String _chromecastUrl = null;
194
+ if (call.getData().has("chromecastUrl")) {
195
+ _chromecastUrl = call.getString("chromecastUrl");
196
+ }
197
+ chromecastUrl = _chromecastUrl;
190
198
  if (call.getData().has("subtitle")) {
191
199
  subtitle = call.getString("subtitle");
192
200
  }
@@ -898,6 +906,76 @@ public class VideoPlayerPlugin extends Plugin {
898
906
  );
899
907
  }
900
908
 
909
+ @PluginMethod
910
+ public void hidePlayer(PluginCall call) {
911
+ this.call = call;
912
+ bridge
913
+ .getActivity()
914
+ .runOnUiThread(
915
+ new Runnable() {
916
+ @Override
917
+ public void run() {
918
+ JSObject ret = new JSObject();
919
+ ret.put("method", "hidePlayer");
920
+ FrameLayout frameLayoutView = getBridge().getActivity().findViewById(frameLayoutViewId);
921
+ if (frameLayoutView != null && fsFragment != null) {
922
+ frameLayoutView.setVisibility(View.GONE);
923
+ Activity activity = getBridge().getActivity();
924
+ activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
925
+ activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
926
+ activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
927
+ ret.put("result", true);
928
+ ret.put("value", true);
929
+ } else {
930
+ ret.put("result", false);
931
+ ret.put("message", "Fullscreen player is not defined");
932
+ }
933
+ call.resolve(ret);
934
+ }
935
+ }
936
+ );
937
+ }
938
+
939
+ @PluginMethod
940
+ public void showPlayer(PluginCall call) {
941
+ this.call = call;
942
+ bridge
943
+ .getActivity()
944
+ .runOnUiThread(
945
+ new Runnable() {
946
+ @Override
947
+ public void run() {
948
+ JSObject ret = new JSObject();
949
+ ret.put("method", "showPlayer");
950
+ FrameLayout frameLayoutView = getBridge().getActivity().findViewById(frameLayoutViewId);
951
+ if (frameLayoutView != null && fsFragment != null) {
952
+ frameLayoutView.setVisibility(View.VISIBLE);
953
+ Activity activity = getBridge().getActivity();
954
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
955
+ activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
956
+ activity
957
+ .getWindow()
958
+ .getDecorView()
959
+ .setSystemUiVisibility(
960
+ View.SYSTEM_UI_FLAG_LOW_PROFILE |
961
+ View.SYSTEM_UI_FLAG_FULLSCREEN |
962
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
963
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
964
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
965
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
966
+ );
967
+ ret.put("result", true);
968
+ ret.put("value", true);
969
+ } else {
970
+ ret.put("result", false);
971
+ ret.put("message", "Fullscreen player is not defined");
972
+ }
973
+ call.resolve(ret);
974
+ }
975
+ }
976
+ );
977
+ }
978
+
901
979
  public boolean isDeviceTV(Context context) {
902
980
  UiModeManager uiManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE);
903
981
  return uiManager != null && uiManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION;
@@ -922,6 +1000,7 @@ public class VideoPlayerPlugin extends Plugin {
922
1000
  createFullScreenFragment(
923
1001
  call,
924
1002
  videoPath,
1003
+ chromecastUrl,
925
1004
  videoRate,
926
1005
  exitOnEnd,
927
1006
  loopOnEnd,
@@ -1088,6 +1167,7 @@ public class VideoPlayerPlugin extends Plugin {
1088
1167
  createFullScreenFragment(
1089
1168
  call,
1090
1169
  videoPath,
1170
+ chromecastUrl,
1091
1171
  videoRate,
1092
1172
  exitOnEnd,
1093
1173
  loopOnEnd,
@@ -1128,6 +1208,7 @@ public class VideoPlayerPlugin extends Plugin {
1128
1208
  private void createFullScreenFragment(
1129
1209
  final PluginCall call,
1130
1210
  String videoPath,
1211
+ String chromecastUrl,
1131
1212
  Float videoRate,
1132
1213
  Boolean exitOnEnd,
1133
1214
  Boolean loopOnEnd,
@@ -1154,6 +1235,7 @@ public class VideoPlayerPlugin extends Plugin {
1154
1235
 
1155
1236
  fsFragment = implementation.createFullScreenFragment(
1156
1237
  videoPath,
1238
+ chromecastUrl,
1157
1239
  videoRate,
1158
1240
  exitOnEnd,
1159
1241
  loopOnEnd,
package/dist/docs.json CHANGED
@@ -299,6 +299,30 @@
299
299
  "capVideoPlayerResult"
300
300
  ],
301
301
  "slug": "exitplayer"
302
+ },
303
+ {
304
+ "name": "hidePlayer",
305
+ "signature": "() => Promise<capVideoPlayerResult>",
306
+ "parameters": [],
307
+ "returns": "Promise<capVideoPlayerResult>",
308
+ "tags": [],
309
+ "docs": "Hide the currently presented player UI without stopping playback (native fullscreen).\n\nCall `showPlayer()` to show it again.",
310
+ "complexTypes": [
311
+ "capVideoPlayerResult"
312
+ ],
313
+ "slug": "hideplayer"
314
+ },
315
+ {
316
+ "name": "showPlayer",
317
+ "signature": "() => Promise<capVideoPlayerResult>",
318
+ "parameters": [],
319
+ "returns": "Promise<capVideoPlayerResult>",
320
+ "tags": [],
321
+ "docs": "Show again a previously hidden player UI (native fullscreen).",
322
+ "complexTypes": [
323
+ "capVideoPlayerResult"
324
+ ],
325
+ "slug": "showplayer"
302
326
  }
303
327
  ],
304
328
  "properties": []
@@ -362,6 +386,13 @@
362
386
  "complexTypes": [],
363
387
  "type": "string | undefined"
364
388
  },
389
+ {
390
+ "name": "chromecastUrl",
391
+ "tags": [],
392
+ "docs": "Optional override URL used when casting to Chromecast (iOS, Android).\n\nThis lets you cast an alternative rendition/manifest (e.g. MPEG-DASH + Widevine)\nwhile keeping the on-device playback URL unchanged (e.g. HLS + FairPlay on iOS).",
393
+ "complexTypes": [],
394
+ "type": "string | undefined"
395
+ },
365
396
  {
366
397
  "name": "subtitle",
367
398
  "tags": [],
@@ -427,6 +458,13 @@
427
458
  "complexTypes": [],
428
459
  "type": "boolean | undefined"
429
460
  },
461
+ {
462
+ "name": "audioCategory",
463
+ "tags": [],
464
+ "docs": "iOS audio session category behavior (iOS).\n- \"ambient\": respects the iPhone silent switch (default)\n- \"playback\": ignores the iPhone silent switch\n- \"moviePlayback\": playback optimized for video and long-form AirPlay\ndefault: \"ambient\"",
465
+ "complexTypes": [],
466
+ "type": "'ambient' | 'playback' | 'moviePlayback' | undefined"
467
+ },
430
468
  {
431
469
  "name": "showControls",
432
470
  "tags": [],
@@ -507,7 +545,7 @@
507
545
  {
508
546
  "name": "drm",
509
547
  "tags": [],
510
- "docs": "DRM configuration for protected content (iOS: FairPlay, Android: Widevine)",
548
+ "docs": "DRM configuration for protected content (iOS: FairPlay, Android: Widevine)\n\nWhen casting, Widevine's `certificateUrl` (license URL) is also forwarded to Chromecast\nreceivers as `media.customData.laurl`.",
511
549
  "complexTypes": [
512
550
  "DrmOptions"
513
551
  ],
@@ -621,6 +659,13 @@
621
659
  "docs": "The URL to send the SPC and receive the CKC license (FairPlay license server URL)",
622
660
  "complexTypes": [],
623
661
  "type": "string | undefined"
662
+ },
663
+ {
664
+ "name": "assetId",
665
+ "tags": [],
666
+ "docs": "Optional FairPlay asset identifier used when generating the SPC.\nDefaults to the `skd://` content identifier from the key request.",
667
+ "complexTypes": [],
668
+ "type": "string | undefined"
624
669
  }
625
670
  ]
626
671
  },
@@ -84,6 +84,16 @@ export interface VideoPlayerPlugin {
84
84
  *
85
85
  */
86
86
  exitPlayer(): Promise<capVideoPlayerResult>;
87
+ /**
88
+ * Hide the currently presented player UI without stopping playback (native fullscreen).
89
+ *
90
+ * Call `showPlayer()` to show it again.
91
+ */
92
+ hidePlayer(): Promise<capVideoPlayerResult>;
93
+ /**
94
+ * Show again a previously hidden player UI (native fullscreen).
95
+ */
96
+ showPlayer(): Promise<capVideoPlayerResult>;
87
97
  }
88
98
  export interface capEchoOptions {
89
99
  /**
@@ -102,6 +112,13 @@ export interface capVideoPlayerOptions {
102
112
  * The url of the video to play
103
113
  */
104
114
  url?: string;
115
+ /**
116
+ * Optional override URL used when casting to Chromecast (iOS, Android).
117
+ *
118
+ * This lets you cast an alternative rendition/manifest (e.g. MPEG-DASH + Widevine)
119
+ * while keeping the on-device playback URL unchanged (e.g. HLS + FairPlay on iOS).
120
+ */
121
+ chromecastUrl?: string;
105
122
  /**
106
123
  * The url of subtitle associated with the video
107
124
  */
@@ -143,6 +160,14 @@ export interface capVideoPlayerOptions {
143
160
  * default: true
144
161
  */
145
162
  bkmodeEnabled?: boolean;
163
+ /**
164
+ * iOS audio session category behavior (iOS).
165
+ * - "ambient": respects the iPhone silent switch (default)
166
+ * - "playback": ignores the iPhone silent switch
167
+ * - "moviePlayback": playback optimized for video and long-form AirPlay
168
+ * default: "ambient"
169
+ */
170
+ audioCategory?: 'ambient' | 'playback' | 'moviePlayback';
146
171
  /**
147
172
  * Show Controls Enable (iOS, Android)
148
173
  * default: true
@@ -204,6 +229,9 @@ export interface capVideoPlayerOptions {
204
229
  artwork?: string;
205
230
  /**
206
231
  * DRM configuration for protected content (iOS: FairPlay, Android: Widevine)
232
+ *
233
+ * When casting, Widevine's `certificateUrl` (license URL) is also forwarded to Chromecast
234
+ * receivers as `media.customData.laurl`.
207
235
  */
208
236
  drm?: DrmOptions;
209
237
  }
@@ -323,6 +351,11 @@ export interface FairPlayDrmOptions {
323
351
  * The URL to send the SPC and receive the CKC license (FairPlay license server URL)
324
352
  */
325
353
  contentKeySpcUrl?: string;
354
+ /**
355
+ * Optional FairPlay asset identifier used when generating the SPC.
356
+ * Defaults to the `skd://` content identifier from the key request.
357
+ */
358
+ assetId?: string;
326
359
  }
327
360
  export interface PlayreadyDrmOptions {
328
361
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface VideoPlayerPlugin {\n /**\n * Initialize a video player\n *\n */\n initPlayer(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;\n /**\n * Return if a given playerId is playing\n *\n */\n isPlaying(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Play the current video from a given playerId\n *\n */\n play(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Pause the current video from a given playerId\n *\n */\n pause(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the duration of the current video from a given playerId\n *\n */\n getDuration(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the current time of the current video from a given playerId\n *\n */\n getCurrentTime(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the current time to seek the current video to from a given playerId\n *\n */\n setCurrentTime(options: capVideoTimeOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the volume of the current video from a given playerId\n *\n */\n getVolume(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the volume of the current video to from a given playerId\n *\n */\n setVolume(options: capVideoVolumeOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the muted of the current video from a given playerId\n *\n */\n getMuted(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the muted of the current video to from a given playerId\n *\n */\n setMuted(options: capVideoMutedOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the rate of the current video from a given playerId\n *\n */\n setRate(options: capVideoRateOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the rate of the current video from a given playerId\n *\n */\n getRate(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Stop all players playing\n *\n */\n stopAllPlayers(): Promise<capVideoPlayerResult>;\n /**\n * Show controller\n *\n */\n showController(): Promise<capVideoPlayerResult>;\n /**\n * isControllerIsFullyVisible\n *\n */\n isControllerIsFullyVisible(): Promise<capVideoPlayerResult>;\n /**\n * Exit player\n *\n */\n exitPlayer(): Promise<capVideoPlayerResult>;\n}\nexport interface capEchoOptions {\n /**\n * String to be echoed\n */\n\n value?: string;\n}\nexport interface capVideoPlayerOptions {\n /**\n * Player mode\n * - \"fullscreen\"\n * - \"embedded\" (Web only)\n */\n mode?: string;\n /**\n * The url of the video to play\n */\n url?: string;\n /**\n * The url of subtitle associated with the video\n */\n subtitle?: string;\n /**\n * The language of subtitle\n * see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers\n */\n language?: string;\n /**\n * SubTitle Options\n */\n subtitleOptions?: SubTitleOptions;\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Initial playing rate\n */\n rate?: number;\n /**\n * Exit on VideoEnd (iOS, Android)\n * default: true\n */\n exitOnEnd?: boolean;\n /**\n * Loop on VideoEnd when exitOnEnd false (iOS, Android)\n * default: false\n */\n loopOnEnd?: boolean;\n /**\n * Picture in Picture Enable (iOS, Android)\n * default: true\n */\n pipEnabled?: boolean;\n /**\n * Background Mode Enable (iOS, Android)\n * default: true\n */\n bkmodeEnabled?: boolean;\n /**\n * Show Controls Enable (iOS, Android)\n * default: true\n */\n showControls?: boolean;\n /**\n * Display Mode [\"all\", \"portrait\", \"landscape\"] (iOS, Android)\n * default: \"all\"\n */\n displayMode?: string;\n /**\n * Component Tag or DOM Element Tag (React app)\n */\n componentTag?: string;\n /**\n * Player Width (mode \"embedded\" only)\n */\n width?: number;\n /**\n * Player height (mode \"embedded\" only)\n */\n height?: number;\n /**\n * Headers for the request (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n headers?: {\n [key: string]: string;\n };\n /**\n * Title shown in the player and Chromecast metadata (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n title?: string;\n /**\n * Subtitle shown below the title in the player and Chromecast metadata (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n smallTitle?: string;\n /**\n * ExoPlayer Progress Bar and Spinner color (Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * Must be a valid hex color code\n * default: #FFFFFF\n */\n accentColor?: string;\n /**\n * Chromecast enable/disable (iOS, Android)\n * iOS requires Google Cast SDK setup and local network Info.plist keys.\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * default: true\n */\n chromecast?: boolean;\n /**\n * Artwork url to be shown in Chromecast player (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * default: \"\"\n */\n artwork?: string;\n /**\n * DRM configuration for protected content (iOS: FairPlay, Android: Widevine)\n */\n drm?: DrmOptions;\n}\nexport interface capVideoPlayerIdOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n}\nexport interface capVideoRateOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Rate value\n */\n rate?: number;\n}\nexport interface capVideoVolumeOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Volume value between [0 - 1]\n */\n volume?: number;\n}\nexport interface capVideoTimeOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Video time value you want to seek to\n */\n seektime?: number;\n}\nexport interface capVideoMutedOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Muted value true or false\n */\n muted?: boolean;\n}\nexport interface capVideoListener {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Video current time when listener triggered\n */\n currentTime?: number;\n}\nexport interface capExitListener {\n /**\n * Dismiss value true or false\n */\n dismiss?: boolean;\n /**\n * Video current time when listener triggered\n */\n currentTime?: number;\n}\nexport interface capVideoPlayerResult {\n /**\n * result set to true when successful else false\n */\n result?: boolean;\n /**\n * method name\n */\n method?: string;\n /**\n * value returned\n */\n value?: any;\n /**\n * message string\n */\n message?: string;\n}\nexport interface SubTitleOptions {\n /**\n * Foreground Color in RGBA (default rgba(255,255,255,1)\n */\n foregroundColor?: string;\n /**\n * Background Color in RGBA (default rgba(0,0,0,1)\n */\n backgroundColor?: string;\n /**\n * Font Size in pixels (default 16)\n */\n fontSize?: number;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\nexport interface FairPlayDrmOptions {\n /**\n * The URL to fetch the FairPlay certificate\n */\n certificateUrl?: string;\n /**\n * The URL to send the SPC and receive the CKC license (FairPlay license server URL)\n */\n contentKeySpcUrl?: string;\n}\nexport interface PlayreadyDrmOptions {\n /**\n * The URL to fetch the PlayReady license\n */\n certificateUrl?: string;\n}\nexport interface WidevineDrmOptions {\n /**\n * The URL to fetch the Widevine license\n */\n certificateUrl?: string;\n}\nexport interface DrmOptions {\n /**\n * FairPlay DRM configuration (iOS)\n */\n fairplay?: FairPlayDrmOptions;\n /**\n * PlayReady DRM configuration\n */\n playready?: PlayreadyDrmOptions;\n /**\n * Widevine DRM configuration (Android)\n */\n widevine?: WidevineDrmOptions;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface VideoPlayerPlugin {\n /**\n * Initialize a video player\n *\n */\n initPlayer(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;\n /**\n * Return if a given playerId is playing\n *\n */\n isPlaying(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Play the current video from a given playerId\n *\n */\n play(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Pause the current video from a given playerId\n *\n */\n pause(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the duration of the current video from a given playerId\n *\n */\n getDuration(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the current time of the current video from a given playerId\n *\n */\n getCurrentTime(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the current time to seek the current video to from a given playerId\n *\n */\n setCurrentTime(options: capVideoTimeOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the volume of the current video from a given playerId\n *\n */\n getVolume(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the volume of the current video to from a given playerId\n *\n */\n setVolume(options: capVideoVolumeOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the muted of the current video from a given playerId\n *\n */\n getMuted(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the muted of the current video to from a given playerId\n *\n */\n setMuted(options: capVideoMutedOptions): Promise<capVideoPlayerResult>;\n /**\n * Set the rate of the current video from a given playerId\n *\n */\n setRate(options: capVideoRateOptions): Promise<capVideoPlayerResult>;\n /**\n * Get the rate of the current video from a given playerId\n *\n */\n getRate(options: capVideoPlayerIdOptions): Promise<capVideoPlayerResult>;\n /**\n * Stop all players playing\n *\n */\n stopAllPlayers(): Promise<capVideoPlayerResult>;\n /**\n * Show controller\n *\n */\n showController(): Promise<capVideoPlayerResult>;\n /**\n * isControllerIsFullyVisible\n *\n */\n isControllerIsFullyVisible(): Promise<capVideoPlayerResult>;\n /**\n * Exit player\n *\n */\n exitPlayer(): Promise<capVideoPlayerResult>;\n /**\n * Hide the currently presented player UI without stopping playback (native fullscreen).\n *\n * Call `showPlayer()` to show it again.\n */\n hidePlayer(): Promise<capVideoPlayerResult>;\n /**\n * Show again a previously hidden player UI (native fullscreen).\n */\n showPlayer(): Promise<capVideoPlayerResult>;\n}\nexport interface capEchoOptions {\n /**\n * String to be echoed\n */\n\n value?: string;\n}\nexport interface capVideoPlayerOptions {\n /**\n * Player mode\n * - \"fullscreen\"\n * - \"embedded\" (Web only)\n */\n mode?: string;\n /**\n * The url of the video to play\n */\n url?: string;\n /**\n * Optional override URL used when casting to Chromecast (iOS, Android).\n *\n * This lets you cast an alternative rendition/manifest (e.g. MPEG-DASH + Widevine)\n * while keeping the on-device playback URL unchanged (e.g. HLS + FairPlay on iOS).\n */\n chromecastUrl?: string;\n /**\n * The url of subtitle associated with the video\n */\n subtitle?: string;\n /**\n * The language of subtitle\n * see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers\n */\n language?: string;\n /**\n * SubTitle Options\n */\n subtitleOptions?: SubTitleOptions;\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Initial playing rate\n */\n rate?: number;\n /**\n * Exit on VideoEnd (iOS, Android)\n * default: true\n */\n exitOnEnd?: boolean;\n /**\n * Loop on VideoEnd when exitOnEnd false (iOS, Android)\n * default: false\n */\n loopOnEnd?: boolean;\n /**\n * Picture in Picture Enable (iOS, Android)\n * default: true\n */\n pipEnabled?: boolean;\n /**\n * Background Mode Enable (iOS, Android)\n * default: true\n */\n bkmodeEnabled?: boolean;\n /**\n * iOS audio session category behavior (iOS).\n * - \"ambient\": respects the iPhone silent switch (default)\n * - \"playback\": ignores the iPhone silent switch\n * - \"moviePlayback\": playback optimized for video and long-form AirPlay\n * default: \"ambient\"\n */\n audioCategory?: 'ambient' | 'playback' | 'moviePlayback';\n /**\n * Show Controls Enable (iOS, Android)\n * default: true\n */\n showControls?: boolean;\n /**\n * Display Mode [\"all\", \"portrait\", \"landscape\"] (iOS, Android)\n * default: \"all\"\n */\n displayMode?: string;\n /**\n * Component Tag or DOM Element Tag (React app)\n */\n componentTag?: string;\n /**\n * Player Width (mode \"embedded\" only)\n */\n width?: number;\n /**\n * Player height (mode \"embedded\" only)\n */\n height?: number;\n /**\n * Headers for the request (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n headers?: {\n [key: string]: string;\n };\n /**\n * Title shown in the player and Chromecast metadata (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n title?: string;\n /**\n * Subtitle shown below the title in the player and Chromecast metadata (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n */\n smallTitle?: string;\n /**\n * ExoPlayer Progress Bar and Spinner color (Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * Must be a valid hex color code\n * default: #FFFFFF\n */\n accentColor?: string;\n /**\n * Chromecast enable/disable (iOS, Android)\n * iOS requires Google Cast SDK setup and local network Info.plist keys.\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * default: true\n */\n chromecast?: boolean;\n /**\n * Artwork url to be shown in Chromecast player (iOS, Android)\n * by Manuel García Marín (https://github.com/PhantomPainX)\n * default: \"\"\n */\n artwork?: string;\n /**\n * DRM configuration for protected content (iOS: FairPlay, Android: Widevine)\n *\n * When casting, Widevine's `certificateUrl` (license URL) is also forwarded to Chromecast\n * receivers as `media.customData.laurl`.\n */\n drm?: DrmOptions;\n}\nexport interface capVideoPlayerIdOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n}\nexport interface capVideoRateOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Rate value\n */\n rate?: number;\n}\nexport interface capVideoVolumeOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Volume value between [0 - 1]\n */\n volume?: number;\n}\nexport interface capVideoTimeOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Video time value you want to seek to\n */\n seektime?: number;\n}\nexport interface capVideoMutedOptions {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Muted value true or false\n */\n muted?: boolean;\n}\nexport interface capVideoListener {\n /**\n * Id of DIV Element parent of the player\n */\n playerId?: string;\n /**\n * Video current time when listener triggered\n */\n currentTime?: number;\n}\nexport interface capExitListener {\n /**\n * Dismiss value true or false\n */\n dismiss?: boolean;\n /**\n * Video current time when listener triggered\n */\n currentTime?: number;\n}\nexport interface capVideoPlayerResult {\n /**\n * result set to true when successful else false\n */\n result?: boolean;\n /**\n * method name\n */\n method?: string;\n /**\n * value returned\n */\n value?: any;\n /**\n * message string\n */\n message?: string;\n}\nexport interface SubTitleOptions {\n /**\n * Foreground Color in RGBA (default rgba(255,255,255,1)\n */\n foregroundColor?: string;\n /**\n * Background Color in RGBA (default rgba(0,0,0,1)\n */\n backgroundColor?: string;\n /**\n * Font Size in pixels (default 16)\n */\n fontSize?: number;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\nexport interface FairPlayDrmOptions {\n /**\n * The URL to fetch the FairPlay certificate\n */\n certificateUrl?: string;\n /**\n * The URL to send the SPC and receive the CKC license (FairPlay license server URL)\n */\n contentKeySpcUrl?: string;\n /**\n * Optional FairPlay asset identifier used when generating the SPC.\n * Defaults to the `skd://` content identifier from the key request.\n */\n assetId?: string;\n}\nexport interface PlayreadyDrmOptions {\n /**\n * The URL to fetch the PlayReady license\n */\n certificateUrl?: string;\n}\nexport interface WidevineDrmOptions {\n /**\n * The URL to fetch the Widevine license\n */\n certificateUrl?: string;\n}\nexport interface DrmOptions {\n /**\n * FairPlay DRM configuration (iOS)\n */\n fairplay?: FairPlayDrmOptions;\n /**\n * PlayReady DRM configuration\n */\n playready?: PlayreadyDrmOptions;\n /**\n * Widevine DRM configuration (Android)\n */\n widevine?: WidevineDrmOptions;\n}\n"]}
@@ -3,6 +3,7 @@ export declare class VideoPlayer {
3
3
  pipMode: boolean;
4
4
  pipWindow: Window | undefined;
5
5
  isPlaying: boolean | undefined;
6
+ isHidden: boolean;
6
7
  private _url;
7
8
  private _playerId;
8
9
  private _container;
@@ -18,8 +19,11 @@ export declare class VideoPlayer {
18
19
  private _videoRate;
19
20
  private _videoExitOnEnd;
20
21
  private _videoLoopOnEnd;
22
+ private _previousContainerDisplay;
21
23
  constructor(mode: string, url: string, playerId: string, rate: number, exitOnEnd: boolean, loopOnEnd: boolean, container: any, zIndex: number, width?: number, height?: number);
22
24
  initialize(): Promise<void>;
25
+ hide(): void;
26
+ show(): void;
23
27
  private createVideoElement;
24
28
  private _goFullscreen;
25
29
  private _setPlayer;