@capgo/capacitor-video-player 8.2.11 → 8.2.13
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 +19 -6
- 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
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Play videos in a native fullscreen player in your Capacitor app, with subtitles, picture in picture and Chromecast support.
|
|
4
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 -
|
|
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 - Build Capacitor apps with AI, ship updates instantly" /></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>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
+
> 🤖 **Building with an AI coding agent?** Install [Capgo skills](https://capgo.app/skills/?ref=plugin_video_player) so Claude Code, Codex, Cursor, Copilot, or Gemini CLI know how to install and use `@capgo/capacitor-video-player` in your Capacitor app: `npx skills add Cap-go/capgo-skills`. Then ask your agent: *"Add @capgo/capacitor-video-player to my Capacitor app and wire it up."* [Agent setup guides](https://capgo.app/agents/?ref=plugin_video_player) · [Hosted MCP](https://capgo.app/docs/ai/mcp/?ref=plugin_video_player)
|
|
15
|
+
|
|
14
16
|
<p align="center">
|
|
15
17
|
<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
18
|
</p>
|
|
@@ -171,6 +173,7 @@ Picture in Picture on Android requires your app activity to declare PiP support
|
|
|
171
173
|
* [`exitPlayer()`](#exitplayer)
|
|
172
174
|
* [`hidePlayer()`](#hideplayer)
|
|
173
175
|
* [`showPlayer()`](#showplayer)
|
|
176
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
174
177
|
* [Interfaces](#interfaces)
|
|
175
178
|
|
|
176
179
|
</docgen-index>
|
|
@@ -479,6 +482,20 @@ Show again a previously hidden player UI (native fullscreen).
|
|
|
479
482
|
--------------------
|
|
480
483
|
|
|
481
484
|
|
|
485
|
+
### getPluginVersion()
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
getPluginVersion() => Promise<{ version: string; }>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Get the native Capacitor plugin version.
|
|
492
|
+
On web, the implementation returns `"web"`.
|
|
493
|
+
|
|
494
|
+
**Returns:** <code>Promise<{ version: string; }></code>
|
|
495
|
+
|
|
496
|
+
--------------------
|
|
497
|
+
|
|
498
|
+
|
|
482
499
|
### Interfaces
|
|
483
500
|
|
|
484
501
|
|
|
@@ -540,10 +557,6 @@ Show again a previously hidden player UI (native fullscreen).
|
|
|
540
557
|
| **`backgroundColor`** | <code>string</code> | Background Color in RGBA (default rgba(0,0,0,1) |
|
|
541
558
|
| **`fontSize`** | <code>number</code> | Font Size in pixels (default 16) |
|
|
542
559
|
|
|
543
|
-
| Method | Signature | Description |
|
|
544
|
-
| -------------------- | -------------------------------------------- | --------------------------------------- |
|
|
545
|
-
| **getPluginVersion** | () => Promise<{ version: string; }> | Get the native Capacitor plugin version |
|
|
546
|
-
|
|
547
560
|
|
|
548
561
|
#### DrmOptions
|
|
549
562
|
|
|
@@ -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() {
|