@capgo/capacitor-jw-player 0.0.5 → 0.0.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 -4
- package/android/src/main/java/ee/forgr/capacitor_jw_player/CastOptionsProvider.java +4 -9
- package/android/src/main/java/ee/forgr/capacitor_jw_player/JwPlayerPlugin.java +62 -59
- package/android/src/main/java/ee/forgr/capacitor_jw_player/PlayerActivity.java +65 -74
- package/dist/docs.json +6 -2
- package/dist/esm/definitions.d.ts +2 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/ios/Sources/JwPlayerPlugin/JwPlayer.swift +4 -4
- package/ios/Sources/JwPlayerPlugin/JwPlayerPlugin.swift +128 -132
- package/ios/Sources/JwPlayerPlugin/LinkedList.swift +28 -29
- package/ios/Sources/JwPlayerPlugin/VideosToPlay.swift +4 -5
- package/package.json +1 -1
|
@@ -16,9 +16,7 @@ import android.view.ViewGroup;
|
|
|
16
16
|
import android.view.WindowManager;
|
|
17
17
|
import android.widget.ImageButton;
|
|
18
18
|
import android.widget.ImageView;
|
|
19
|
-
|
|
20
19
|
import androidx.appcompat.app.AppCompatActivity;
|
|
21
|
-
|
|
22
20
|
import com.google.android.gms.cast.CastMediaControlIntent;
|
|
23
21
|
import com.google.android.gms.cast.LaunchOptions;
|
|
24
22
|
import com.google.android.gms.cast.framework.CastOptions;
|
|
@@ -31,8 +29,8 @@ import com.jwplayer.pub.api.configuration.PlayerConfig;
|
|
|
31
29
|
// import com.jwplayer.pub.api.configuration.PlaylistConfig; // Already commented/removed - ensure it's gone
|
|
32
30
|
import com.jwplayer.pub.api.configuration.UiConfig;
|
|
33
31
|
import com.jwplayer.pub.api.events.*;
|
|
34
|
-
import com.jwplayer.pub.api.events.listeners.VideoPlayerEvents;
|
|
35
32
|
import com.jwplayer.pub.api.events.listeners.AdvertisingEvents;
|
|
33
|
+
import com.jwplayer.pub.api.events.listeners.VideoPlayerEvents;
|
|
36
34
|
import com.jwplayer.pub.api.license.LicenseUtil;
|
|
37
35
|
import com.jwplayer.pub.api.media.captions.Caption;
|
|
38
36
|
import com.jwplayer.pub.api.media.captions.CaptionType;
|
|
@@ -41,12 +39,13 @@ import com.jwplayer.pub.api.media.playlists.PlaylistItem;
|
|
|
41
39
|
import com.jwplayer.pub.ui.viewmodels.ControlbarViewModel;
|
|
42
40
|
import com.jwplayer.pub.view.JWPlayerView;
|
|
43
41
|
import com.jwplayer.ui.views.ControlbarView;
|
|
44
|
-
|
|
45
42
|
import java.util.ArrayList;
|
|
46
43
|
import java.util.List;
|
|
47
44
|
import java.util.Locale;
|
|
48
45
|
|
|
49
|
-
public class PlayerActivity
|
|
46
|
+
public class PlayerActivity
|
|
47
|
+
extends AppCompatActivity
|
|
48
|
+
implements
|
|
50
49
|
VideoPlayerEvents.OnFullscreenListener,
|
|
51
50
|
VideoPlayerEvents.OnReadyListener,
|
|
52
51
|
VideoPlayerEvents.OnErrorListener,
|
|
@@ -61,12 +60,12 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
61
60
|
VideoPlayerEvents.OnTimeListener,
|
|
62
61
|
AdvertisingEvents.OnAdErrorListener,
|
|
63
62
|
AdvertisingEvents.OnAdWarningListener,
|
|
64
|
-
VideoPlayerEvents.OnMetaListener
|
|
65
|
-
{
|
|
63
|
+
VideoPlayerEvents.OnMetaListener {
|
|
66
64
|
|
|
67
65
|
private static final String TAG = "PlayerActivity";
|
|
68
66
|
public static final String EXTRA_MEDIA_URL = "mediaUrl";
|
|
69
67
|
public static final String EXTRA_MEDIA_TYPE = "mediaType";
|
|
68
|
+
public static final String AUTOSTART = "autostartMedia";
|
|
70
69
|
|
|
71
70
|
private JWPlayerView mPlayerView;
|
|
72
71
|
private JWPlayer mPlayer;
|
|
@@ -81,14 +80,13 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
81
80
|
|
|
82
81
|
// Make activity fullscreen - moved after setContentView
|
|
83
82
|
if (getWindow() != null) {
|
|
84
|
-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
85
|
-
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
83
|
+
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
86
84
|
// Keep the screen on during playback
|
|
87
85
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
88
86
|
} else {
|
|
89
87
|
Log.e(TAG, "Window is null in onCreate!");
|
|
90
88
|
}
|
|
91
|
-
|
|
89
|
+
|
|
92
90
|
// Hide navigation bar and enable immersive mode
|
|
93
91
|
hideSystemUI();
|
|
94
92
|
|
|
@@ -96,35 +94,32 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
96
94
|
mPlayer = mPlayerView.getPlayer();
|
|
97
95
|
mPlayer.registerActivityForPip(this, getSupportActionBar());
|
|
98
96
|
|
|
99
|
-
|
|
100
97
|
// Delte fullscreen button
|
|
101
98
|
ControlbarView customControlBar = mPlayerView.getControlsContainer().getControlbarView();
|
|
102
99
|
ImageView enterFullScreenButton = customControlBar.findViewById(com.longtailvideo.jwplayer.R.id.controlbar_enter_fullscreen_btn);
|
|
103
100
|
ImageView exitFullScreenButton = customControlBar.findViewById(com.longtailvideo.jwplayer.R.id.controlbar_exit_fullscreen_btn);
|
|
104
101
|
if (enterFullScreenButton != null && enterFullScreenButton.getParent() != null) {
|
|
105
|
-
((ViewGroup)enterFullScreenButton.getParent()).removeView(enterFullScreenButton);
|
|
102
|
+
((ViewGroup) enterFullScreenButton.getParent()).removeView(enterFullScreenButton);
|
|
106
103
|
}
|
|
107
104
|
if (exitFullScreenButton != null && exitFullScreenButton.getParent() != null) {
|
|
108
|
-
((ViewGroup)exitFullScreenButton.getParent()).removeView(exitFullScreenButton);
|
|
105
|
+
((ViewGroup) exitFullScreenButton.getParent()).removeView(exitFullScreenButton);
|
|
109
106
|
}
|
|
110
107
|
|
|
111
108
|
// Setup Close Button
|
|
112
109
|
mCloseButton = findViewById(R.id.close_button);
|
|
113
110
|
mCloseButton.setOnClickListener(v -> finish());
|
|
114
111
|
|
|
115
|
-
ControlbarViewModel controlbarViewModel =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
mCloseButton.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
|
|
112
|
+
ControlbarViewModel controlbarViewModel = (ControlbarViewModel) mPlayer.getViewModelForUiGroup(UiGroup.CONTROLBAR);
|
|
113
|
+
|
|
114
|
+
controlbarViewModel
|
|
115
|
+
.isUiLayerVisible()
|
|
116
|
+
.observe(this, isVisible -> {
|
|
117
|
+
if (isInPictureInPictureMode()) {
|
|
118
|
+
mCloseButton.setVisibility(View.GONE);
|
|
119
|
+
return;
|
|
126
120
|
}
|
|
127
|
-
|
|
121
|
+
mCloseButton.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
|
|
122
|
+
});
|
|
128
123
|
|
|
129
124
|
// Set the static instance reference in the plugin
|
|
130
125
|
JwPlayerPlugin.setStaticPlayerInstance(mPlayer);
|
|
@@ -141,10 +136,11 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
141
136
|
Intent intent = getIntent();
|
|
142
137
|
String mediaUrl = intent.getStringExtra(EXTRA_MEDIA_URL);
|
|
143
138
|
String mediaType = intent.getStringExtra(EXTRA_MEDIA_TYPE);
|
|
139
|
+
boolean autostart = intent.getBooleanExtra(AUTOSTART, false);
|
|
144
140
|
|
|
145
141
|
if (mediaUrl != null && mediaType != null) {
|
|
146
142
|
Log.d(TAG, "Received Media URL: " + mediaUrl + ", Type: " + mediaType);
|
|
147
|
-
loadMedia(mediaUrl, mediaType);
|
|
143
|
+
loadMedia(mediaUrl, mediaType, autostart);
|
|
148
144
|
} else {
|
|
149
145
|
Log.e(TAG, "Error: Media URL or Type not provided in Intent.");
|
|
150
146
|
// Notify plugin of error?
|
|
@@ -152,20 +148,17 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
|
|
155
|
-
private void loadMedia(String mediaUrl, String mediaType) {
|
|
151
|
+
private void loadMedia(String mediaUrl, String mediaType, boolean autostart) {
|
|
156
152
|
PlaylistItem playlistItem = new PlaylistItem.Builder()
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
.file(mediaUrl)
|
|
154
|
+
// .title("Video Title") // Optional
|
|
155
|
+
// .description("Video Description") // Optional
|
|
156
|
+
.build();
|
|
161
157
|
|
|
162
158
|
List<PlaylistItem> playlist = new ArrayList<>();
|
|
163
159
|
playlist.add(playlistItem);
|
|
164
160
|
|
|
165
|
-
PlayerConfig config = new PlayerConfig.Builder()
|
|
166
|
-
.playlist(playlist)
|
|
167
|
-
.autostart(true)
|
|
168
|
-
.build();
|
|
161
|
+
PlayerConfig config = new PlayerConfig.Builder().playlist(playlist).autostart(autostart).build();
|
|
169
162
|
|
|
170
163
|
mPlayer.setup(config);
|
|
171
164
|
Log.d(TAG, "Player setup initiated.");
|
|
@@ -203,7 +196,7 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
203
196
|
super.onPause();
|
|
204
197
|
Log.d(TAG, "onPause");
|
|
205
198
|
if (mPlayer != null && !isInPictureInPictureMode()) { // Don't pause if entering PiP
|
|
206
|
-
|
|
199
|
+
// mPlayer.pause();
|
|
207
200
|
}
|
|
208
201
|
}
|
|
209
202
|
|
|
@@ -252,11 +245,13 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
252
245
|
public void onUserLeaveHint() {
|
|
253
246
|
// Enter PiP if supported when user navigates away (e.g., home button)
|
|
254
247
|
super.onUserLeaveHint();
|
|
255
|
-
if (
|
|
256
|
-
|
|
248
|
+
if (
|
|
249
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
|
250
|
+
getPackageManager().hasSystemFeature(getPackageManager().FEATURE_PICTURE_IN_PICTURE)
|
|
251
|
+
) {
|
|
257
252
|
if (mPlayer != null && mPlayer.getState() == PlayerState.PLAYING) {
|
|
258
|
-
|
|
259
|
-
|
|
253
|
+
Log.d(TAG, "User leaving hint, entering PiP mode.");
|
|
254
|
+
// enterPictureInPictureMode();
|
|
260
255
|
}
|
|
261
256
|
}
|
|
262
257
|
}
|
|
@@ -276,7 +271,6 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
276
271
|
// PiP is active, hide controls like the close button
|
|
277
272
|
mCloseButton.setVisibility(View.GONE);
|
|
278
273
|
} else {
|
|
279
|
-
|
|
280
274
|
// PiP is inactive, restore UI
|
|
281
275
|
mCloseButton.setVisibility(View.VISIBLE);
|
|
282
276
|
if (getWindow() != null) {
|
|
@@ -327,7 +321,7 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
327
321
|
JwPlayerPlugin.notifyPlaylistComplete();
|
|
328
322
|
finish(); // Close activity when playlist finishes
|
|
329
323
|
}
|
|
330
|
-
|
|
324
|
+
|
|
331
325
|
public void onPause(PauseEvent pauseEvent) {
|
|
332
326
|
Log.d(TAG, "onPause event: state=" + pauseEvent.getOldState());
|
|
333
327
|
JwPlayerPlugin.notifyPause(pauseEvent.getPauseReason().name());
|
|
@@ -345,15 +339,15 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
345
339
|
float aspectRatio = (float) metadata.getWidth() / metadata.getHeight();
|
|
346
340
|
int width = metadata.getWidth();
|
|
347
341
|
int height = metadata.getHeight();
|
|
348
|
-
|
|
342
|
+
|
|
349
343
|
if (aspectRatio > 2.38f) {
|
|
350
344
|
// Too wide, adjust width, let's not handle it
|
|
351
345
|
return;
|
|
352
|
-
} else if (aspectRatio < 1/2.38f) {
|
|
346
|
+
} else if (aspectRatio < 1 / 2.38f) {
|
|
353
347
|
// Too tall, adjust height, let's not handle it for now
|
|
354
348
|
return;
|
|
355
349
|
}
|
|
356
|
-
|
|
350
|
+
|
|
357
351
|
Rational rational = new Rational(width, height);
|
|
358
352
|
// Get the display metrics for the current screen
|
|
359
353
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
@@ -361,13 +355,13 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
361
355
|
int screenWidth = displayMetrics.widthPixels;
|
|
362
356
|
|
|
363
357
|
// Calculate one-third of screen width and round to nearest even number
|
|
364
|
-
int thirdWidth = (int) Math.round((double)screenWidth / 3.0);
|
|
358
|
+
int thirdWidth = (int) Math.round((double) screenWidth / 3.0);
|
|
365
359
|
if (thirdWidth % 2 != 0) {
|
|
366
360
|
// If odd, round up to next even number
|
|
367
361
|
thirdWidth += 1;
|
|
368
362
|
}
|
|
369
363
|
|
|
370
|
-
int thirdHeight = (int) Math.round(((double)screenWidth / 3.0) * aspectRatio);
|
|
364
|
+
int thirdHeight = (int) Math.round(((double) screenWidth / 3.0) * aspectRatio);
|
|
371
365
|
if (thirdHeight % 2 != 0) {
|
|
372
366
|
// If odd, round up to next even number
|
|
373
367
|
thirdHeight += 1;
|
|
@@ -383,17 +377,17 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
383
377
|
Log.d(TAG, "onComplete event");
|
|
384
378
|
JwPlayerPlugin.notifyComplete();
|
|
385
379
|
}
|
|
386
|
-
|
|
380
|
+
|
|
387
381
|
public void onSeek(SeekEvent seekEvent) {
|
|
388
|
-
|
|
389
|
-
|
|
382
|
+
Log.d(TAG, "onSeek event: position=" + seekEvent.getPosition() + ", offset=" + seekEvent.getOffset());
|
|
383
|
+
JwPlayerPlugin.notifySeek(seekEvent.getPosition(), seekEvent.getOffset());
|
|
390
384
|
}
|
|
391
385
|
|
|
392
386
|
public void onSeeked(SeekedEvent seekedEvent) {
|
|
393
|
-
|
|
394
|
-
|
|
387
|
+
Log.d(TAG, "onSeeked event");
|
|
388
|
+
JwPlayerPlugin.notifySeeked();
|
|
395
389
|
}
|
|
396
|
-
|
|
390
|
+
|
|
397
391
|
public void onTime(TimeEvent timeEvent) {
|
|
398
392
|
// Log.v(TAG, "onTime event: position=" + timeEvent.getPosition() + ", duration=" + timeEvent.getDuration());
|
|
399
393
|
JwPlayerPlugin.notifyTime(timeEvent.getPosition(), timeEvent.getDuration());
|
|
@@ -406,28 +400,26 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
406
400
|
Log.e(TAG, "Window is null in hideSystemUI!");
|
|
407
401
|
return;
|
|
408
402
|
}
|
|
409
|
-
|
|
403
|
+
|
|
410
404
|
// For AppCompatActivity, use the support library methods
|
|
411
405
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
412
406
|
getWindow().setDecorFitsSystemWindows(false);
|
|
413
407
|
android.view.WindowInsetsController insetsController = getWindow().getInsetsController();
|
|
414
408
|
if (insetsController != null) {
|
|
415
|
-
insetsController.hide(
|
|
416
|
-
|
|
417
|
-
android.view.WindowInsets.Type.navigationBars());
|
|
418
|
-
insetsController.setSystemBarsBehavior(
|
|
419
|
-
android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
|
409
|
+
insetsController.hide(android.view.WindowInsets.Type.statusBars() | android.view.WindowInsets.Type.navigationBars());
|
|
410
|
+
insetsController.setSystemBarsBehavior(android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
|
420
411
|
}
|
|
421
412
|
} else {
|
|
422
413
|
// Legacy method for older Android versions
|
|
423
414
|
View decorView = getWindow().getDecorView();
|
|
424
415
|
decorView.setSystemUiVisibility(
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
416
|
+
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
|
417
|
+
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
|
418
|
+
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
419
|
+
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
420
|
+
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
421
|
+
View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
422
|
+
);
|
|
431
423
|
}
|
|
432
424
|
}
|
|
433
425
|
|
|
@@ -437,19 +429,18 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
437
429
|
Log.e(TAG, "Window is null in showSystemUI!");
|
|
438
430
|
return;
|
|
439
431
|
}
|
|
440
|
-
|
|
432
|
+
|
|
441
433
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
442
434
|
getWindow().setDecorFitsSystemWindows(true);
|
|
443
|
-
getWindow()
|
|
444
|
-
|
|
445
|
-
|
|
435
|
+
getWindow()
|
|
436
|
+
.getInsetsController()
|
|
437
|
+
.show(android.view.WindowInsets.Type.statusBars() | android.view.WindowInsets.Type.navigationBars());
|
|
446
438
|
} else {
|
|
447
439
|
// Legacy method for older Android versions
|
|
448
440
|
View decorView = getWindow().getDecorView();
|
|
449
441
|
decorView.setSystemUiVisibility(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
|
442
|
+
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
443
|
+
);
|
|
453
444
|
}
|
|
454
445
|
}
|
|
455
446
|
|
|
@@ -459,7 +450,7 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
459
450
|
Log.e(TAG, "Window is null in toggleSystemUI!");
|
|
460
451
|
return;
|
|
461
452
|
}
|
|
462
|
-
|
|
453
|
+
|
|
463
454
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
|
464
455
|
// For Android 11+, use InsetsController to check visibility
|
|
465
456
|
// Just toggle - there's no direct visibility check for R+
|
|
@@ -474,4 +465,4 @@ public class PlayerActivity extends AppCompatActivity implements
|
|
|
474
465
|
}
|
|
475
466
|
}
|
|
476
467
|
}
|
|
477
|
-
}
|
|
468
|
+
}
|
package/dist/docs.json
CHANGED
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
"name": "play",
|
|
39
|
-
"signature": "(options: { mediaUrl: string; mediaType: 'video' | 'playlist'; }) => Promise<void>",
|
|
39
|
+
"signature": "(options: { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean; }) => Promise<void>",
|
|
40
40
|
"parameters": [
|
|
41
41
|
{
|
|
42
42
|
"name": "options",
|
|
43
43
|
"docs": "- The options for the JW Player",
|
|
44
|
-
"type": "{ mediaUrl: string; mediaType: 'video' | 'playlist'; }"
|
|
44
|
+
"type": "{ mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean | undefined; }"
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
47
|
"returns": "Promise<void>",
|
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
"name": "param",
|
|
59
59
|
"text": "options.mediaType - The type of media to play"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"name": "param",
|
|
63
|
+
"text": "options.autostart - Whether to start the media automatically. Default is false."
|
|
64
|
+
},
|
|
61
65
|
{
|
|
62
66
|
"name": "returns",
|
|
63
67
|
"text": "A promise that resolves when the command is executed"
|
|
@@ -13,11 +13,13 @@ export interface JwPlayerPlugin {
|
|
|
13
13
|
* @param options - The options for the JW Player
|
|
14
14
|
* @param options.mediaUrl - The URL of the media to play
|
|
15
15
|
* @param options.mediaType - The type of media to play
|
|
16
|
+
* @param options.autostart - Whether to start the media automatically. Default is false.
|
|
16
17
|
* @returns A promise that resolves when the command is executed
|
|
17
18
|
*/
|
|
18
19
|
play(options: {
|
|
19
20
|
mediaUrl: string;
|
|
20
21
|
mediaType: 'video' | 'playlist';
|
|
22
|
+
autostart?: boolean;
|
|
21
23
|
}): Promise<void>;
|
|
22
24
|
/**
|
|
23
25
|
* Pause the currently playing media
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface JwPlayerPlugin {\n /**\n * Initialize the JW Player\n * @param options - The options for the JW Player\n * @param options.licenseKey - The license key for the JW Player. Keep in mind that this is different for iOS and Android.\n * @returns A promise that resolves when initialized\n */\n initialize(options: { licenseKey: string }): Promise<void>;\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface JwPlayerPlugin {\n /**\n * Initialize the JW Player\n * @param options - The options for the JW Player\n * @param options.licenseKey - The license key for the JW Player. Keep in mind that this is different for iOS and Android.\n * @returns A promise that resolves when initialized\n */\n initialize(options: { licenseKey: string }): Promise<void>;\n\n /**\n * Play a video\n * @param options - The options for the JW Player\n * @param options.mediaUrl - The URL of the media to play\n * @param options.mediaType - The type of media to play\n * @param options.autostart - Whether to start the media automatically. Default is false.\n * @returns A promise that resolves when the command is executed\n */\n play(options: { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean }): Promise<void>;\n\n /**\n * Pause the currently playing media\n * @returns A promise that resolves when the command is executed\n */\n pause(): Promise<void>;\n\n /**\n * Resume the currently paused media\n * @returns A promise that resolves when the command is executed\n */\n resume(): Promise<void>;\n\n /**\n * Stop the currently playing media\n * @returns A promise that resolves when the command is executed\n */\n stop(): Promise<void>;\n\n /**\n * Seek to a specific position in the currently playing media\n * @param options - Options for seeking\n * @param options.time - The position to seek to in seconds\n * @returns A promise that resolves when the command is executed\n */\n seekTo(options: { time: number }): Promise<void>;\n\n /**\n * Set the volume level\n * @param options - Options for setting volume\n * @param options.volume - The volume level (0.0 to 1.0)\n * @returns A promise that resolves when the command is executed\n */\n setVolume(options: { volume: number }): Promise<void>;\n\n /**\n * Get the current position in the media\n * @returns A promise that resolves with the current position in seconds\n */\n getPosition(): Promise<{ position: number }>;\n\n /**\n * Get the current player state\n * @returns A promise that resolves with the player state\n */\n getState(): Promise<{ state: number }>;\n\n /**\n * Set the playback speed\n * @param options - Options for setting speed\n * @param options.speed - The playback speed (0.5 to 2.0)\n * @returns A promise that resolves when the command is executed\n */\n setSpeed(options: { speed: number }): Promise<void>;\n\n /**\n * Set the current item in the playlist by index\n * @param options - Options for setting playlist item\n * @param options.index - The index of the item to play\n * @returns A promise that resolves when the command is executed\n */\n setPlaylistIndex(options: { index: number }): Promise<void>;\n\n /**\n * Load a playlist\n * @param options - Options for loading a playlist\n * @param options.playlistUrl - The URL of the playlist\n * @returns A promise that resolves when the command is executed\n */\n loadPlaylist(options: { playlistUrl: string }): Promise<void>;\n\n /**\n * Load a playlist with items\n * @param options - Options for loading a playlist\n * @param options.playlist - Array of playlist items\n * @returns A promise that resolves when the command is executed\n */\n loadPlaylistWithItems(options: { playlist: any[] }): Promise<void>;\n\n /**\n * Get available audio tracks\n * @returns A promise that resolves with available audio tracks\n */\n getAudioTracks(): Promise<{ tracks: any[] }>;\n\n /**\n * Get the current audio track\n * @returns A promise that resolves with current audio track index\n */\n getCurrentAudioTrack(): Promise<{ index: number }>;\n\n /**\n * Set the current audio track\n * @param options - Options for setting audio track\n * @param options.index - The index of the audio track\n * @returns A promise that resolves when the command is executed\n */\n setCurrentAudioTrack(options: { index: number }): Promise<void>;\n\n /**\n * Get the available captions/subtitles\n * @returns A promise that resolves with available captions\n */\n getCaptions(): Promise<{ captions: any[] }>;\n\n /**\n * Get the current captions/subtitles track\n * @returns A promise that resolves with current captions track index\n */\n getCurrentCaptions(): Promise<{ index: number }>;\n\n /**\n * Set the current captions/subtitles track\n * @param options - Options for setting captions track\n * @param options.index - The index of the captions track\n * @returns A promise that resolves when the command is executed\n */\n setCurrentCaptions(options: { index: number }): Promise<void>;\n\n /**\n * Get the current playlist\n * @returns A promise that resolves to the current playlist\n */\n currentPlaylist(): Promise<any>;\n}\n"]}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,UAAU,CAAC,OAA+B;QAC9C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,KAAK,CAAC,UAAU,CAAC,OAA+B;QAC9C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA+D;QACxE,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAA0B;QACrC,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAA4B;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAA2B;QACxC,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAA2B;QAChD,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAiC;QAClD,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,QAA6B;QACvD,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,QAA2B;QACpD,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAA2B;QAClD,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { JwPlayerPlugin } from './definitions';\n\nexport class JwPlayerWeb extends WebPlugin implements JwPlayerPlugin {\n async initialize(options: { licenseKey: string }): Promise<void> {\n console.log('INITIALIZE', options);\n return;\n }\n\n async play(_options: { mediaUrl: string; mediaType: 'video' | 'playlist' }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async pause(): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async stop(): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async seekTo(_options: { time: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async setVolume(_options: { volume: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getPosition(): Promise<{ position: number }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getState(): Promise<{ state: number }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async setSpeed(_options: { speed: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async setPlaylistIndex(_options: { index: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async loadPlaylist(_options: { playlistUrl: string }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async loadPlaylistWithItems(_options: { playlist: any[] }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getAudioTracks(): Promise<{ tracks: any[] }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getCurrentAudioTrack(): Promise<{ index: number }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async setCurrentAudioTrack(_options: { index: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getCaptions(): Promise<{ captions: any[] }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async getCurrentCaptions(): Promise<{ index: number }> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async setCurrentCaptions(_options: { index: number }): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async currentPlaylist(): Promise<any> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n\n async resume(): Promise<void> {\n throw this.unimplemented('JW Player is not available in web.');\n }\n}\n"]}
|
|
@@ -5,19 +5,19 @@ import Capacitor
|
|
|
5
5
|
@objc public func initialize(_ call: CAPPluginCall) -> String {
|
|
6
6
|
return "initialized"
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
@objc public func play(_ call: CAPPluginCall) -> String {
|
|
10
10
|
return "playing"
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
@objc public func pause(_ call: CAPPluginCall) -> String {
|
|
14
14
|
return "paused"
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
@objc public func stop(_ call: CAPPluginCall) -> String {
|
|
18
18
|
return "stopped"
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
@objc public func seekTo(_ call: CAPPluginCall) -> String {
|
|
22
22
|
return "seeked"
|
|
23
23
|
}
|