@capgo/capacitor-video-player 8.2.10 → 8.2.12

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
@@ -1,11 +1,28 @@
1
1
  # @capgo/capacitor-video-player
2
- <a href="https://capgo.app/"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-video-player" alt="Capgo - Instant updates for Capacitor" /></a>
2
+
3
+ Play videos in a native fullscreen player in your Capacitor app, with subtitles, picture in picture and Chromecast support.
4
+
5
+ <a href="https://capgo.app/?ref=plugin_video_player"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-video-player" alt="Capgo - Instant updates for Capacitor" /></a>
3
6
 
4
7
  <div align="center">
5
- <h2><a href="https://capgo.app/?ref=plugin_video_player"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
- <h2><a href="https://capgo.app/consulting/?ref=plugin_video_player"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
8
+ <p><b>Capgo</b>: push fixes to your Capacitor users in minutes, build signed iOS and Android apps without a Mac, and roll back in one click.</p>
9
+ <h2><a href="https://capgo.app/register/?ref=plugin_video_player">➡️ Get started for free</a></h2>
10
+ <p>14-day unlimited free trial. No credit card required</p>
11
+ <p><a href="https://capgo.app/consulting/?ref=plugin_video_player">Missing a feature? We'll build the plugin for you 💪</a></p>
7
12
  </div>
8
- Native video playback for Capacitor apps
13
+
14
+ <p align="center">
15
+ <img src="https://raw.githubusercontent.com/Cap-go/capacitor-video-player/main/assets/github-social-preview.png" alt="@capgo/capacitor-video-player for Capacitor apps" width="300" />
16
+ </p>
17
+
18
+ ## Key features
19
+
20
+ - **Players**: `initPlayer()` creates a player for a URL, with `play()`, `pause()` and `stopAllPlayers()`.
21
+ - **Playback control**: `setCurrentTime()`, `setVolume()`, `setMuted()` and `setRate()`, with matching getters.
22
+ - **Subtitles**: one or more subtitle tracks with language options.
23
+ - **Native extras**: picture in picture, background mode, loop on end and Chromecast casting.
24
+ - **Controller**: `showController()` and `isControllerIsFullyVisible()` for the native controls.
25
+ - **Platforms**: iOS, Android and Web. Web also supports an embedded player mode.
9
26
 
10
27
  ## Documentation
11
28
 
@@ -154,6 +171,7 @@ Picture in Picture on Android requires your app activity to declare PiP support
154
171
  * [`exitPlayer()`](#exitplayer)
155
172
  * [`hidePlayer()`](#hideplayer)
156
173
  * [`showPlayer()`](#showplayer)
174
+ * [`getPluginVersion()`](#getpluginversion)
157
175
  * [Interfaces](#interfaces)
158
176
 
159
177
  </docgen-index>
@@ -462,6 +480,20 @@ Show again a previously hidden player UI (native fullscreen).
462
480
  --------------------
463
481
 
464
482
 
483
+ ### getPluginVersion()
484
+
485
+ ```typescript
486
+ getPluginVersion() => Promise<{ version: string; }>
487
+ ```
488
+
489
+ Get the native Capacitor plugin version.
490
+ On web, the implementation returns `"web"`.
491
+
492
+ **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
493
+
494
+ --------------------
495
+
496
+
465
497
  ### Interfaces
466
498
 
467
499
 
@@ -523,10 +555,6 @@ Show again a previously hidden player UI (native fullscreen).
523
555
  | **`backgroundColor`** | <code>string</code> | Background Color in RGBA (default rgba(0,0,0,1) |
524
556
  | **`fontSize`** | <code>number</code> | Font Size in pixels (default 16) |
525
557
 
526
- | Method | Signature | Description |
527
- | -------------------- | -------------------------------------------- | --------------------------------------- |
528
- | **getPluginVersion** | () =&gt; Promise&lt;{ version: string; }&gt; | Get the native Capacitor plugin version |
529
-
530
558
 
531
559
  #### DrmOptions
532
560
 
@@ -141,9 +141,19 @@ public class FullscreenExoPlayerFragment extends Fragment {
141
141
  private static final Rational MIN_PIP_ASPECT_RATIO = new Rational(100, 239);
142
142
  private static final Rational MAX_PIP_ASPECT_RATIO = new Rational(239, 100);
143
143
  public static final long UNKNOWN_TIME = -1L;
144
- private final List<String> supportedFormat = Arrays.asList(
145
- new String[] { "mp4", "webm", "ogv", "3gp", "flv", "dash", "mpd", "m3u8", "ism", "ytube", "" }
146
- );
144
+ private final List<String> supportedFormat = Arrays.asList(new String[] {
145
+ "mp4",
146
+ "webm",
147
+ "ogv",
148
+ "3gp",
149
+ "flv",
150
+ "dash",
151
+ "mpd",
152
+ "m3u8",
153
+ "ism",
154
+ "ytube",
155
+ ""
156
+ });
147
157
  private Player.Listener listener;
148
158
  private StyledPlayerView styledPlayerView;
149
159
  private String vType = null;
@@ -417,12 +427,14 @@ public class FullscreenExoPlayerFragment extends Fragment {
417
427
  subtitleLanguages.add(language != null ? language : "en");
418
428
  }
419
429
 
420
- stForeColor = subTitleOptions != null && subTitleOptions.has("foregroundColor")
421
- ? subTitleOptions.getString("foregroundColor")
422
- : "rgba(255,255,255,1)";
423
- stBackColor = subTitleOptions != null && subTitleOptions.has("backgroundColor")
424
- ? subTitleOptions.getString("backgroundColor")
425
- : "rgba(0,0,0,1)";
430
+ stForeColor =
431
+ subTitleOptions != null && subTitleOptions.has("foregroundColor")
432
+ ? subTitleOptions.getString("foregroundColor")
433
+ : "rgba(255,255,255,1)";
434
+ stBackColor =
435
+ subTitleOptions != null && subTitleOptions.has("backgroundColor")
436
+ ? subTitleOptions.getString("backgroundColor")
437
+ : "rgba(0,0,0,1)";
426
438
  stFontSize = subTitleOptions != null && subTitleOptions.has("fontSize") ? subTitleOptions.getInteger("fontSize") : 16;
427
439
  // get video type
428
440
  vType = getVideoType(uri);
@@ -1247,9 +1259,8 @@ public class FullscreenExoPlayerFragment extends Fragment {
1247
1259
  styledPlayerView.setUseController(false);
1248
1260
  linearLayout.setVisibility(View.INVISIBLE);
1249
1261
  }
1250
- long seekPosition = player.getCurrentPosition() == UNKNOWN_TIME
1251
- ? 0
1252
- : Math.min(Math.max(0, timeSecond * 1000), player.getDuration());
1262
+ long seekPosition =
1263
+ player.getCurrentPosition() == UNKNOWN_TIME ? 0 : Math.min(Math.max(0, timeSecond * 1000), player.getDuration());
1253
1264
  player.seekTo(seekPosition);
1254
1265
  }
1255
1266
 
@@ -1382,7 +1393,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
1382
1393
  // Fall back to path-segment based detection
1383
1394
  String ret = null;
1384
1395
  Object obj = uri.getLastPathSegment();
1385
- String lastSegment = (obj == null) ? "" : uri.getLastPathSegment();
1396
+ String lastSegment = obj == null ? "" : uri.getLastPathSegment();
1386
1397
  for (String type : supportedFormat) {
1387
1398
  if (ret != null) break;
1388
1399
  if (lastSegment.length() > 0 && lastSegment.contains(type)) ret = type;
@@ -1404,7 +1415,7 @@ public class FullscreenExoPlayerFragment extends Fragment {
1404
1415
  }
1405
1416
  }
1406
1417
  }
1407
- ret = (ret != null) ? ret : "";
1418
+ ret = ret != null ? ret : "";
1408
1419
  return ret;
1409
1420
  }
1410
1421
 
@@ -33,16 +33,14 @@ public class VideoRecyclerViewHolder extends RecyclerView.ViewHolder {
33
33
  tv_title.setText(modelVideo.getTitle());
34
34
  tv_duration.setText(modelVideo.getDuration());
35
35
 
36
- parentFragment
37
- .getActivity()
38
- .runOnUiThread(
39
- new Runnable() {
40
- @Override
41
- public void run() {
42
- Picasso.get().load(modelVideo.getData()).placeholder(R.drawable.ic_image_background).fit().into(tv_thumbnail);
43
- }
36
+ parentFragment.getActivity().runOnUiThread(
37
+ new Runnable() {
38
+ @Override
39
+ public void run() {
40
+ Picasso.get().load(modelVideo.getData()).placeholder(R.drawable.ic_image_background).fit().into(tv_thumbnail);
44
41
  }
45
- );
42
+ }
43
+ );
46
44
 
47
45
  parent.setOnClickListener(
48
46
  new View.OnClickListener() {