@capgo/capacitor-video-player 8.2.11 → 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 +16 -5
- package/android/src/main/java/com/capgo/videoplayer/FullscreenExoPlayerFragment.java +25 -14
- package/android/src/main/java/com/capgo/videoplayer/PickerVideo/VideoRecyclerViewHolder.java +7 -9
- package/android/src/main/java/com/capgo/videoplayer/VideoPlayerPlugin.java +403 -447
- package/dist/docs.json +16 -21
- package/dist/esm/definitions.d.ts +9 -9
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/VideoPlayerPlugin/VideoPlayerPlugin.swift +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Play videos in a native fullscreen player in your Capacitor app, with subtitles,
|
|
|
5
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>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<p><b>Capgo</b>:
|
|
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
9
|
<h2><a href="https://capgo.app/register/?ref=plugin_video_player">➡️ Get started for free</a></h2>
|
|
10
10
|
<p>14-day unlimited free trial. No credit card required</p>
|
|
11
11
|
<p><a href="https://capgo.app/consulting/?ref=plugin_video_player">Missing a feature? We'll build the plugin for you 💪</a></p>
|
|
@@ -171,6 +171,7 @@ Picture in Picture on Android requires your app activity to declare PiP support
|
|
|
171
171
|
* [`exitPlayer()`](#exitplayer)
|
|
172
172
|
* [`hidePlayer()`](#hideplayer)
|
|
173
173
|
* [`showPlayer()`](#showplayer)
|
|
174
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
174
175
|
* [Interfaces](#interfaces)
|
|
175
176
|
|
|
176
177
|
</docgen-index>
|
|
@@ -479,6 +480,20 @@ Show again a previously hidden player UI (native fullscreen).
|
|
|
479
480
|
--------------------
|
|
480
481
|
|
|
481
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<{ version: string; }></code>
|
|
493
|
+
|
|
494
|
+
--------------------
|
|
495
|
+
|
|
496
|
+
|
|
482
497
|
### Interfaces
|
|
483
498
|
|
|
484
499
|
|
|
@@ -540,10 +555,6 @@ Show again a previously hidden player UI (native fullscreen).
|
|
|
540
555
|
| **`backgroundColor`** | <code>string</code> | Background Color in RGBA (default rgba(0,0,0,1) |
|
|
541
556
|
| **`fontSize`** | <code>number</code> | Font Size in pixels (default 16) |
|
|
542
557
|
|
|
543
|
-
| Method | Signature | Description |
|
|
544
|
-
| -------------------- | -------------------------------------------- | --------------------------------------- |
|
|
545
|
-
| **getPluginVersion** | () => Promise<{ version: string; }> | Get the native Capacitor plugin version |
|
|
546
|
-
|
|
547
558
|
|
|
548
559
|
#### DrmOptions
|
|
549
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
|
-
|
|
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 =
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1418
|
+
ret = ret != null ? ret : "";
|
|
1408
1419
|
return ret;
|
|
1409
1420
|
}
|
|
1410
1421
|
|
package/android/src/main/java/com/capgo/videoplayer/PickerVideo/VideoRecyclerViewHolder.java
CHANGED
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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() {
|