@capgo/capacitor-jw-player 0.0.17 → 0.0.21
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/Package.swift +0 -5
- package/android/src/main/java/ee/forgr/capacitor_jw_player/PlayerActivity.java +4 -4
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.js +16 -13
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +16 -13
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +16 -13
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/JwPlayerPlugin/JwPlayerPlugin.swift +45 -45
- package/ios/Sources/JwPlayerPlugin/VideosToPlay.swift +1 -0
- package/package.json +1 -1
package/Package.swift
CHANGED
|
@@ -27,11 +27,6 @@ let package = Package(
|
|
|
27
27
|
.product(name: "JWPlayerKit", package: "JWPlayerKit-package")
|
|
28
28
|
],
|
|
29
29
|
path: "ios/Sources/JwPlayerPlugin"),
|
|
30
|
-
.binaryTarget(
|
|
31
|
-
name: "GoogleCast",
|
|
32
|
-
url: "https://dl.google.com/dl/chromecast/sdk/ios/GoogleCastSDK-ios-\(GoogleCastMetadata.version)_dynamic.zip",
|
|
33
|
-
checksum: GoogleCastMetadata.checksum
|
|
34
|
-
),
|
|
35
30
|
.testTarget(
|
|
36
31
|
name: "JwPlayerPluginTests",
|
|
37
32
|
dependencies: ["JwPlayerPlugin"],
|
|
@@ -151,10 +151,10 @@ public class PlayerActivity
|
|
|
151
151
|
private void loadMedia(String mediaUrl, String mediaType, boolean autostart) {
|
|
152
152
|
if (mediaType.equals("video")) {
|
|
153
153
|
PlaylistItem playlistItem = new PlaylistItem.Builder()
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
.file(mediaUrl)
|
|
155
|
+
// .title("Video Title") // Optional
|
|
156
|
+
// .description("Video Description") // Optional
|
|
157
|
+
.build();
|
|
158
158
|
|
|
159
159
|
List<PlaylistItem> playlist = new ArrayList<>();
|
|
160
160
|
playlist.add(playlistItem);
|
|
@@ -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 * @param options.playerUrl - The player URL for the JW Player. This is used on the web in order to load the player.\n * @returns A promise that resolves when initialized\n */\n initialize(options: { licenseKey: string; playerUrl?: 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\n/**\n * Events emitted by the JW Player plugin across all platforms.\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 * @param options.playerUrl - The player URL for the JW Player. This is used on the web in order to load the player.\n * @returns A promise that resolves when initialized\n */\n initialize(options: { licenseKey: string; playerUrl?: 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\n/**\n * Events emitted by the JW Player plugin across all platforms.\n *\n * The plugin uses Capacitor's event system. You can listen to these events using:\n * ```\n * import { Plugins } from '@capacitor/core';\n * const { JwPlayer } = Plugins;\n *\n * JwPlayer.addListener('ready', () => {\n * console.log('Player is ready');\n * });\n * ```\n */\nexport interface JwPlayerEvents {\n /**\n * Fired when the player is ready\n */\n ready: void;\n\n /**\n * Fired when the player encounters an error\n */\n error: {\n message: string;\n code?: number;\n };\n\n /**\n * Fired when playback starts or resumes\n */\n play: {\n reason: string;\n };\n\n /**\n * Fired when playback is paused\n */\n pause: {\n reason: string;\n };\n\n /**\n * Fired when playback completes (reaches the end)\n */\n complete: void;\n\n /**\n * Fired when the player is seeking to a new position\n */\n seek: {\n position: number;\n offset: number;\n };\n\n /**\n * Fired when the player has completed seeking\n */\n seeked: void;\n\n /**\n * Fired periodically during playback with time updates (throttled)\n */\n time: {\n position: number;\n duration: number;\n };\n\n /**\n * Fired when a new playlist item starts playing\n */\n playlistItem: {\n index: number;\n title?: string;\n };\n\n /**\n * Fired when playback of the entire playlist is complete\n */\n playlistComplete: void;\n\n /**\n * Fired when the player enters or exits fullscreen mode\n */\n fullscreen: {\n fullscreen: boolean;\n };\n\n /**\n * Fired when the player UI controls visibility changes (show/hide)\n */\n controlsChanged: {\n visible: boolean;\n };\n\n /**\n * Fired when the player is dismissed (closed)\n */\n playerDismissed: void;\n\n /**\n * Fired when the player enters Picture-in-Picture mode (iOS/Android only)\n */\n pipStarted: {\n isInPictureInPictureMode?: boolean;\n };\n\n /**\n * Fired when the player exits Picture-in-Picture mode (iOS/Android only)\n */\n pipStopped: {\n isInPictureInPictureMode?: boolean;\n };\n}\n"]}
|
package/dist/esm/web.js
CHANGED
|
@@ -11,8 +11,8 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
11
11
|
// Generate a UUID that works in all browsers
|
|
12
12
|
generateUUID() {
|
|
13
13
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
14
|
-
const r = Math.random() * 16 | 0;
|
|
15
|
-
const v = c === 'x' ? r : (r & 0x3 | 0x8
|
|
14
|
+
const r = (Math.random() * 16) | 0;
|
|
15
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
16
16
|
return v.toString(16);
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -65,7 +65,7 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
65
65
|
Object.assign(playerDiv.style, {
|
|
66
66
|
width: '100%',
|
|
67
67
|
height: '100%',
|
|
68
|
-
margin: '0 auto'
|
|
68
|
+
margin: '0 auto',
|
|
69
69
|
});
|
|
70
70
|
// Create close (X) button
|
|
71
71
|
const closeButton = document.createElement('button');
|
|
@@ -87,15 +87,16 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
87
87
|
display: 'flex',
|
|
88
88
|
justifyContent: 'center',
|
|
89
89
|
alignItems: 'center',
|
|
90
|
-
padding: '0'
|
|
90
|
+
padding: '0',
|
|
91
91
|
});
|
|
92
92
|
// Add click handler to close button
|
|
93
93
|
closeButton.addEventListener('click', () => {
|
|
94
|
+
var _a;
|
|
94
95
|
if (this.jwPlayerInstance) {
|
|
95
96
|
this.jwPlayerInstance.remove();
|
|
96
97
|
this.jwPlayerInstance = null;
|
|
97
98
|
}
|
|
98
|
-
if (this.overlayDiv
|
|
99
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
99
100
|
document.body.removeChild(this.overlayDiv);
|
|
100
101
|
this.overlayDiv = null;
|
|
101
102
|
this.notifyListeners('playerDismissed', {});
|
|
@@ -132,10 +133,10 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
132
133
|
this.jwPlayerInstance.on('error', (error) => {
|
|
133
134
|
this.notifyListeners('error', {
|
|
134
135
|
message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',
|
|
135
|
-
code: (error === null || error === void 0 ? void 0 : error.code) || -1
|
|
136
|
+
code: (error === null || error === void 0 ? void 0 : error.code) || -1,
|
|
136
137
|
});
|
|
137
138
|
});
|
|
138
|
-
// Play event
|
|
139
|
+
// Play event
|
|
139
140
|
this.jwPlayerInstance.on('play', () => {
|
|
140
141
|
this.notifyListeners('play', { reason: 'external' });
|
|
141
142
|
});
|
|
@@ -151,7 +152,7 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
151
152
|
this.jwPlayerInstance.on('seek', (event) => {
|
|
152
153
|
this.notifyListeners('seek', {
|
|
153
154
|
position: event.position,
|
|
154
|
-
offset: event.offset
|
|
155
|
+
offset: event.offset,
|
|
155
156
|
});
|
|
156
157
|
});
|
|
157
158
|
// Time event (throttled to not fire too often)
|
|
@@ -162,7 +163,7 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
162
163
|
if (now - lastTimeUpdate > 1000) {
|
|
163
164
|
this.notifyListeners('time', {
|
|
164
165
|
position: event.position,
|
|
165
|
-
duration: event.duration
|
|
166
|
+
duration: event.duration,
|
|
166
167
|
});
|
|
167
168
|
lastTimeUpdate = now;
|
|
168
169
|
}
|
|
@@ -172,7 +173,7 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
172
173
|
var _a;
|
|
173
174
|
this.notifyListeners('playlistItem', {
|
|
174
175
|
index: event.index,
|
|
175
|
-
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || ''
|
|
176
|
+
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || '',
|
|
176
177
|
});
|
|
177
178
|
});
|
|
178
179
|
// Playlist complete event
|
|
@@ -182,7 +183,7 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
182
183
|
// Controls visibility event
|
|
183
184
|
this.jwPlayerInstance.on('controls', (event) => {
|
|
184
185
|
this.notifyListeners('controlsChanged', {
|
|
185
|
-
visible: event.controls
|
|
186
|
+
visible: event.controls,
|
|
186
187
|
});
|
|
187
188
|
});
|
|
188
189
|
}
|
|
@@ -195,10 +196,11 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
195
196
|
throw new Error('Player not active');
|
|
196
197
|
}
|
|
197
198
|
async stop() {
|
|
199
|
+
var _a;
|
|
198
200
|
if (this.jwPlayerInstance) {
|
|
199
201
|
this.jwPlayerInstance.remove();
|
|
200
202
|
this.jwPlayerInstance = null;
|
|
201
|
-
if (this.overlayDiv
|
|
203
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
202
204
|
document.body.removeChild(this.overlayDiv);
|
|
203
205
|
this.overlayDiv = null;
|
|
204
206
|
}
|
|
@@ -249,7 +251,8 @@ export class JwPlayerWeb extends WebPlugin {
|
|
|
249
251
|
case 'paused':
|
|
250
252
|
state = 3;
|
|
251
253
|
break;
|
|
252
|
-
default:
|
|
254
|
+
default:
|
|
255
|
+
state = 0; // idle
|
|
253
256
|
}
|
|
254
257
|
return { state };
|
|
255
258
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IAA1C;;QACE,8CAA8C;QACtC,eAAU,GAA0B,IAAI,CAAC;QACjD,2BAA2B;QACnB,qBAAgB,GAA6B,IAAI,CAAC;IAwX5D,CAAC;IAtXC,6CAA6C;IACrC,YAAY;QAClB,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAS,CAAC;YACvE,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;YACjC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;YAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAmD;QAClE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAEpC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,C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AAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;YACzD,OAAO,EAAE,KAAK,EAAE,CAAC;SAClB;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAA0B;QACjD,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACxD,OAAO;SACR;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;SAC5C;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC7B,sCAAsC;YACtC,OAAO;SACR;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { JwPlayerPlugin } from './definitions';\n\ndeclare global {\n interface Window { jwplayer: JWPlayerStatic; }\n}\n\nexport class JwPlayerWeb extends WebPlugin implements JwPlayerPlugin {\n // Track if our overlay is currently displayed\n private overlayDiv: HTMLDivElement | null = null;\n // Store JW Player instance\n private jwPlayerInstance: jwplayer.JWPlayer | null = null;\n\n // Generate a UUID that works in all browsers\n private generateUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n const r = Math.random() * 16 | 0;\n const v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n\n async initialize(options: { licenseKey: string; playerUrl?: string }): Promise<void> {\n console.log('INITIALIZE', options);\n \n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n \n const playerUrl = options.playerUrl;\n \n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n\n async play(options: { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean }): Promise<void> {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n \n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n \n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n \n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto'\n });\n \n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0'\n });\n \n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n \n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n \n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n \n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n \n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video'}],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n \n return;\n }\n\n // Setup unified event handlers to match iOS and Android\n private setupEventHandlers() {\n if (!this.jwPlayerInstance) return;\n \n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n \n // Error event\n this.jwPlayerInstance.on('error', (error: any) => {\n this.notifyListeners('error', {\n message: error?.message || 'Unknown error',\n code: error?.code || -1\n });\n });\n \n // Play event \n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n \n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n \n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n \n // Seek event\n this.jwPlayerInstance.on('seek', (event: { position: number; offset: number }) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset\n });\n });\n \n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event: { position: number; duration: number }) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration\n });\n lastTimeUpdate = now;\n }\n });\n \n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event: { index: number; item: any }) => {\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: event.item?.title || ''\n });\n });\n \n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n \n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event: { controls: boolean }) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls\n });\n });\n }\n\n async pause(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n\n async stop(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n \n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n \n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n\n async seekTo(options: { time: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n\n async setVolume(options: { volume: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getPosition(): Promise<{ position: number }> {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n\n async getState(): Promise<{ state: number }> {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n \n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n \n switch (jwState) {\n case 'buffering': state = 1; break;\n case 'playing': state = 2; break;\n case 'paused': state = 3; break;\n default: state = 0; // idle\n }\n \n return { state };\n }\n\n async setSpeed(options: { speed: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n\n async setPlaylistIndex(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async loadPlaylist(options: { playlistUrl: string }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n\n async loadPlaylistWithItems(options: { playlist: any[] }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getAudioTracks(): Promise<{ tracks: any[] }> {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n\n async getCurrentAudioTrack(): Promise<{ index: number }> {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n\n async setCurrentAudioTrack(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getCaptions(): Promise<{ captions: any[] }> {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n\n async getCurrentCaptions(): Promise<{ index: number }> {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n\n async setCurrentCaptions(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async currentPlaylist(): Promise<any> {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n\n async resume(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IAA1C;;QACE,8CAA8C;QACtC,eAAU,GAA0B,IAAI,CAAC;QACjD,2BAA2B;QACnB,qBAAgB,GAA6B,IAAI,CAAC;IA+X5D,CAAC;IA7XC,6CAA6C;IACrC,YAAY;QAClB,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC;YACxE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAAmD;QAClE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAEpC,MAAM,IAAI,OAAO,CAAC,C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,IAAI,CAAC,gBAAgB,EAAE;YACzB,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;YACzD,OAAO,EAAE,KAAK,EAAE,CAAC;SAClB;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAA0B;QACjD,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACxD,OAAO;SACR;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;SAC5C;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAC7B,sCAAsC;YACtC,OAAO;SACR;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { JwPlayerPlugin } from './definitions';\n\ndeclare global {\n interface Window {\n jwplayer: JWPlayerStatic;\n }\n}\n\nexport class JwPlayerWeb extends WebPlugin implements JwPlayerPlugin {\n // Track if our overlay is currently displayed\n private overlayDiv: HTMLDivElement | null = null;\n // Store JW Player instance\n private jwPlayerInstance: jwplayer.JWPlayer | null = null;\n\n // Generate a UUID that works in all browsers\n private generateUUID(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n\n async initialize(options: { licenseKey: string; playerUrl?: string }): Promise<void> {\n console.log('INITIALIZE', options);\n\n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n\n const playerUrl = options.playerUrl;\n\n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n\n async play(options: { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean }): Promise<void> {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n\n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n\n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n\n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto',\n });\n\n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0',\n });\n\n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if (this.overlayDiv?.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n\n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n\n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n\n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n\n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video' }],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n\n return;\n }\n\n // Setup unified event handlers to match iOS and Android\n private setupEventHandlers() {\n if (!this.jwPlayerInstance) return;\n\n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n\n // Error event\n this.jwPlayerInstance.on('error', (error: any) => {\n this.notifyListeners('error', {\n message: error?.message || 'Unknown error',\n code: error?.code || -1,\n });\n });\n\n // Play event\n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n\n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n\n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n\n // Seek event\n this.jwPlayerInstance.on('seek', (event: { position: number; offset: number }) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset,\n });\n });\n\n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event: { position: number; duration: number }) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration,\n });\n lastTimeUpdate = now;\n }\n });\n\n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event: { index: number; item: any }) => {\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: event.item?.title || '',\n });\n });\n\n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n\n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event: { controls: boolean }) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls,\n });\n });\n }\n\n async pause(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n\n async stop(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n\n if (this.overlayDiv?.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n\n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n\n async seekTo(options: { time: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n\n async setVolume(options: { volume: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getPosition(): Promise<{ position: number }> {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n\n async getState(): Promise<{ state: number }> {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n\n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n\n switch (jwState) {\n case 'buffering':\n state = 1;\n break;\n case 'playing':\n state = 2;\n break;\n case 'paused':\n state = 3;\n break;\n default:\n state = 0; // idle\n }\n\n return { state };\n }\n\n async setSpeed(options: { speed: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n\n async setPlaylistIndex(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async loadPlaylist(options: { playlistUrl: string }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n\n async loadPlaylistWithItems(options: { playlist: any[] }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getAudioTracks(): Promise<{ tracks: any[] }> {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n\n async getCurrentAudioTrack(): Promise<{ index: number }> {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n\n async setCurrentAudioTrack(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async getCaptions(): Promise<{ captions: any[] }> {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n\n async getCurrentCaptions(): Promise<{ index: number }> {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n\n async setCurrentCaptions(options: { index: number }): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n\n async currentPlaylist(): Promise<any> {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n\n async resume(): Promise<void> {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -18,8 +18,8 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
18
18
|
// Generate a UUID that works in all browsers
|
|
19
19
|
generateUUID() {
|
|
20
20
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
21
|
-
const r = Math.random() * 16 | 0;
|
|
22
|
-
const v = c === 'x' ? r : (r & 0x3 | 0x8
|
|
21
|
+
const r = (Math.random() * 16) | 0;
|
|
22
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
23
23
|
return v.toString(16);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -72,7 +72,7 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
72
72
|
Object.assign(playerDiv.style, {
|
|
73
73
|
width: '100%',
|
|
74
74
|
height: '100%',
|
|
75
|
-
margin: '0 auto'
|
|
75
|
+
margin: '0 auto',
|
|
76
76
|
});
|
|
77
77
|
// Create close (X) button
|
|
78
78
|
const closeButton = document.createElement('button');
|
|
@@ -94,15 +94,16 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
94
94
|
display: 'flex',
|
|
95
95
|
justifyContent: 'center',
|
|
96
96
|
alignItems: 'center',
|
|
97
|
-
padding: '0'
|
|
97
|
+
padding: '0',
|
|
98
98
|
});
|
|
99
99
|
// Add click handler to close button
|
|
100
100
|
closeButton.addEventListener('click', () => {
|
|
101
|
+
var _a;
|
|
101
102
|
if (this.jwPlayerInstance) {
|
|
102
103
|
this.jwPlayerInstance.remove();
|
|
103
104
|
this.jwPlayerInstance = null;
|
|
104
105
|
}
|
|
105
|
-
if (this.overlayDiv
|
|
106
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
106
107
|
document.body.removeChild(this.overlayDiv);
|
|
107
108
|
this.overlayDiv = null;
|
|
108
109
|
this.notifyListeners('playerDismissed', {});
|
|
@@ -139,10 +140,10 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
139
140
|
this.jwPlayerInstance.on('error', (error) => {
|
|
140
141
|
this.notifyListeners('error', {
|
|
141
142
|
message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',
|
|
142
|
-
code: (error === null || error === void 0 ? void 0 : error.code) || -1
|
|
143
|
+
code: (error === null || error === void 0 ? void 0 : error.code) || -1,
|
|
143
144
|
});
|
|
144
145
|
});
|
|
145
|
-
// Play event
|
|
146
|
+
// Play event
|
|
146
147
|
this.jwPlayerInstance.on('play', () => {
|
|
147
148
|
this.notifyListeners('play', { reason: 'external' });
|
|
148
149
|
});
|
|
@@ -158,7 +159,7 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
158
159
|
this.jwPlayerInstance.on('seek', (event) => {
|
|
159
160
|
this.notifyListeners('seek', {
|
|
160
161
|
position: event.position,
|
|
161
|
-
offset: event.offset
|
|
162
|
+
offset: event.offset,
|
|
162
163
|
});
|
|
163
164
|
});
|
|
164
165
|
// Time event (throttled to not fire too often)
|
|
@@ -169,7 +170,7 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
169
170
|
if (now - lastTimeUpdate > 1000) {
|
|
170
171
|
this.notifyListeners('time', {
|
|
171
172
|
position: event.position,
|
|
172
|
-
duration: event.duration
|
|
173
|
+
duration: event.duration,
|
|
173
174
|
});
|
|
174
175
|
lastTimeUpdate = now;
|
|
175
176
|
}
|
|
@@ -179,7 +180,7 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
179
180
|
var _a;
|
|
180
181
|
this.notifyListeners('playlistItem', {
|
|
181
182
|
index: event.index,
|
|
182
|
-
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || ''
|
|
183
|
+
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || '',
|
|
183
184
|
});
|
|
184
185
|
});
|
|
185
186
|
// Playlist complete event
|
|
@@ -189,7 +190,7 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
189
190
|
// Controls visibility event
|
|
190
191
|
this.jwPlayerInstance.on('controls', (event) => {
|
|
191
192
|
this.notifyListeners('controlsChanged', {
|
|
192
|
-
visible: event.controls
|
|
193
|
+
visible: event.controls,
|
|
193
194
|
});
|
|
194
195
|
});
|
|
195
196
|
}
|
|
@@ -202,10 +203,11 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
202
203
|
throw new Error('Player not active');
|
|
203
204
|
}
|
|
204
205
|
async stop() {
|
|
206
|
+
var _a;
|
|
205
207
|
if (this.jwPlayerInstance) {
|
|
206
208
|
this.jwPlayerInstance.remove();
|
|
207
209
|
this.jwPlayerInstance = null;
|
|
208
|
-
if (this.overlayDiv
|
|
210
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
209
211
|
document.body.removeChild(this.overlayDiv);
|
|
210
212
|
this.overlayDiv = null;
|
|
211
213
|
}
|
|
@@ -256,7 +258,8 @@ class JwPlayerWeb extends core.WebPlugin {
|
|
|
256
258
|
case 'paused':
|
|
257
259
|
state = 3;
|
|
258
260
|
break;
|
|
259
|
-
default:
|
|
261
|
+
default:
|
|
262
|
+
state = 0; // idle
|
|
260
263
|
}
|
|
261
264
|
return { state };
|
|
262
265
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst JwPlayer = registerPlugin('JwPlayer', {\n web: () => import('./web').then((m) => new m.JwPlayerWeb()),\n});\nexport * from './definitions';\nexport { JwPlayer };\n//# sourceMappingURL=index.js.map","/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\nexport class JwPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n // Track if our overlay is currently displayed\n this.overlayDiv = null;\n // Store JW Player instance\n this.jwPlayerInstance = null;\n }\n // Generate a UUID that works in all browsers\n generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = Math.random() * 16 | 0;\n const v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n const playerUrl = options.playerUrl;\n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n async play(options) {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto'\n });\n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0'\n });\n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video' }],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n return;\n }\n // Setup unified event handlers to match iOS and Android\n setupEventHandlers() {\n if (!this.jwPlayerInstance)\n return;\n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n // Error event\n this.jwPlayerInstance.on('error', (error) => {\n this.notifyListeners('error', {\n message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',\n code: (error === null || error === void 0 ? void 0 : error.code) || -1\n });\n });\n // Play event \n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n // Seek event\n this.jwPlayerInstance.on('seek', (event) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset\n });\n });\n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration\n });\n lastTimeUpdate = now;\n }\n });\n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event) => {\n var _a;\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || ''\n });\n });\n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls\n });\n });\n }\n async pause() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n async stop() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n async seekTo(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n async setVolume(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n async getPosition() {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n async getState() {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n switch (jwState) {\n case 'buffering':\n state = 1;\n break;\n case 'playing':\n state = 2;\n break;\n case 'paused':\n state = 3;\n break;\n default: state = 0; // idle\n }\n return { state };\n }\n async setSpeed(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n async setPlaylistIndex(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylist(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylistWithItems(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n async getAudioTracks() {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n async getCurrentAudioTrack() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentAudioTrack(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async getCaptions() {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n async getCurrentCaptions() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentCaptions(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async currentPlaylist() {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n async resume() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACHD;AAEO,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B;AACA,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI;AAC9B;AACA,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI;AACpC;AACA;AACA,IAAI,YAAY,GAAG;AACnB,QAAQ,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;AACpF,YAAY,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;AAC5C,YAAY,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AACrD,YAAY,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjC,SAAS,CAAC;AACV;AACA,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC;AAC1C,QAAQ,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;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ACnC,YAAY,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE;AACxC;AACA,YAAY;AACZ;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AAC5C;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst JwPlayer = registerPlugin('JwPlayer', {\n web: () => import('./web').then((m) => new m.JwPlayerWeb()),\n});\nexport * from './definitions';\nexport { JwPlayer };\n//# sourceMappingURL=index.js.map","/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\nexport class JwPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n // Track if our overlay is currently displayed\n this.overlayDiv = null;\n // Store JW Player instance\n this.jwPlayerInstance = null;\n }\n // Generate a UUID that works in all browsers\n generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n const playerUrl = options.playerUrl;\n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n async play(options) {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto',\n });\n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0',\n });\n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n var _a;\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video' }],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n return;\n }\n // Setup unified event handlers to match iOS and Android\n setupEventHandlers() {\n if (!this.jwPlayerInstance)\n return;\n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n // Error event\n this.jwPlayerInstance.on('error', (error) => {\n this.notifyListeners('error', {\n message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',\n code: (error === null || error === void 0 ? void 0 : error.code) || -1,\n });\n });\n // Play event\n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n // Seek event\n this.jwPlayerInstance.on('seek', (event) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset,\n });\n });\n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration,\n });\n lastTimeUpdate = now;\n }\n });\n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event) => {\n var _a;\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || '',\n });\n });\n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls,\n });\n });\n }\n async pause() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n async stop() {\n var _a;\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n async seekTo(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n async setVolume(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n async getPosition() {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n async getState() {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n switch (jwState) {\n case 'buffering':\n state = 1;\n break;\n case 'playing':\n state = 2;\n break;\n case 'paused':\n state = 3;\n break;\n default:\n state = 0; // idle\n }\n return { state };\n }\n async setSpeed(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n async setPlaylistIndex(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylist(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylistWithItems(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n async getAudioTracks() {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n async getCurrentAudioTrack() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentAudioTrack(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async getCaptions() {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n async getCurrentCaptions() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentCaptions(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async currentPlaylist() {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n async resume() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;AAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC;;ACHD;AAEO,MAAM,WAAW,SAASC,cAAS,CAAC;AAC3C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B;AACA,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI;AAC9B;AACA,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI;AACpC;AACA;AACA,IAAI,YAAY,GAAG;AACnB,QAAQ,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;AACpF,YAAY,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;AAC9C,YAAY,M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AmB,CAAC;AAC5C;AACA,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACnC,YAAY,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC;AACnE,YAAY;AACZ;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AAC5C;AACA,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACnC,YAAY,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE;AACtD;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AAC5C;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;AACnC,YAAY,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE;AACxC;AACA,YAAY;AACZ;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AAC5C;AACA;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -17,8 +17,8 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
17
17
|
// Generate a UUID that works in all browsers
|
|
18
18
|
generateUUID() {
|
|
19
19
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
20
|
-
const r = Math.random() * 16 | 0;
|
|
21
|
-
const v = c === 'x' ? r : (r & 0x3 | 0x8
|
|
20
|
+
const r = (Math.random() * 16) | 0;
|
|
21
|
+
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
22
22
|
return v.toString(16);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -71,7 +71,7 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
71
71
|
Object.assign(playerDiv.style, {
|
|
72
72
|
width: '100%',
|
|
73
73
|
height: '100%',
|
|
74
|
-
margin: '0 auto'
|
|
74
|
+
margin: '0 auto',
|
|
75
75
|
});
|
|
76
76
|
// Create close (X) button
|
|
77
77
|
const closeButton = document.createElement('button');
|
|
@@ -93,15 +93,16 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
93
93
|
display: 'flex',
|
|
94
94
|
justifyContent: 'center',
|
|
95
95
|
alignItems: 'center',
|
|
96
|
-
padding: '0'
|
|
96
|
+
padding: '0',
|
|
97
97
|
});
|
|
98
98
|
// Add click handler to close button
|
|
99
99
|
closeButton.addEventListener('click', () => {
|
|
100
|
+
var _a;
|
|
100
101
|
if (this.jwPlayerInstance) {
|
|
101
102
|
this.jwPlayerInstance.remove();
|
|
102
103
|
this.jwPlayerInstance = null;
|
|
103
104
|
}
|
|
104
|
-
if (this.overlayDiv
|
|
105
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
105
106
|
document.body.removeChild(this.overlayDiv);
|
|
106
107
|
this.overlayDiv = null;
|
|
107
108
|
this.notifyListeners('playerDismissed', {});
|
|
@@ -138,10 +139,10 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
138
139
|
this.jwPlayerInstance.on('error', (error) => {
|
|
139
140
|
this.notifyListeners('error', {
|
|
140
141
|
message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',
|
|
141
|
-
code: (error === null || error === void 0 ? void 0 : error.code) || -1
|
|
142
|
+
code: (error === null || error === void 0 ? void 0 : error.code) || -1,
|
|
142
143
|
});
|
|
143
144
|
});
|
|
144
|
-
// Play event
|
|
145
|
+
// Play event
|
|
145
146
|
this.jwPlayerInstance.on('play', () => {
|
|
146
147
|
this.notifyListeners('play', { reason: 'external' });
|
|
147
148
|
});
|
|
@@ -157,7 +158,7 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
157
158
|
this.jwPlayerInstance.on('seek', (event) => {
|
|
158
159
|
this.notifyListeners('seek', {
|
|
159
160
|
position: event.position,
|
|
160
|
-
offset: event.offset
|
|
161
|
+
offset: event.offset,
|
|
161
162
|
});
|
|
162
163
|
});
|
|
163
164
|
// Time event (throttled to not fire too often)
|
|
@@ -168,7 +169,7 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
168
169
|
if (now - lastTimeUpdate > 1000) {
|
|
169
170
|
this.notifyListeners('time', {
|
|
170
171
|
position: event.position,
|
|
171
|
-
duration: event.duration
|
|
172
|
+
duration: event.duration,
|
|
172
173
|
});
|
|
173
174
|
lastTimeUpdate = now;
|
|
174
175
|
}
|
|
@@ -178,7 +179,7 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
178
179
|
var _a;
|
|
179
180
|
this.notifyListeners('playlistItem', {
|
|
180
181
|
index: event.index,
|
|
181
|
-
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || ''
|
|
182
|
+
title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || '',
|
|
182
183
|
});
|
|
183
184
|
});
|
|
184
185
|
// Playlist complete event
|
|
@@ -188,7 +189,7 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
188
189
|
// Controls visibility event
|
|
189
190
|
this.jwPlayerInstance.on('controls', (event) => {
|
|
190
191
|
this.notifyListeners('controlsChanged', {
|
|
191
|
-
visible: event.controls
|
|
192
|
+
visible: event.controls,
|
|
192
193
|
});
|
|
193
194
|
});
|
|
194
195
|
}
|
|
@@ -201,10 +202,11 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
201
202
|
throw new Error('Player not active');
|
|
202
203
|
}
|
|
203
204
|
async stop() {
|
|
205
|
+
var _a;
|
|
204
206
|
if (this.jwPlayerInstance) {
|
|
205
207
|
this.jwPlayerInstance.remove();
|
|
206
208
|
this.jwPlayerInstance = null;
|
|
207
|
-
if (this.overlayDiv
|
|
209
|
+
if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
208
210
|
document.body.removeChild(this.overlayDiv);
|
|
209
211
|
this.overlayDiv = null;
|
|
210
212
|
}
|
|
@@ -255,7 +257,8 @@ var capacitorJwPlayer = (function (exports, core) {
|
|
|
255
257
|
case 'paused':
|
|
256
258
|
state = 3;
|
|
257
259
|
break;
|
|
258
|
-
default:
|
|
260
|
+
default:
|
|
261
|
+
state = 0; // idle
|
|
259
262
|
}
|
|
260
263
|
return { state };
|
|
261
264
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst JwPlayer = registerPlugin('JwPlayer', {\n web: () => import('./web').then((m) => new m.JwPlayerWeb()),\n});\nexport * from './definitions';\nexport { JwPlayer };\n//# sourceMappingURL=index.js.map","/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\nexport class JwPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n // Track if our overlay is currently displayed\n this.overlayDiv = null;\n // Store JW Player instance\n this.jwPlayerInstance = null;\n }\n // Generate a UUID that works in all browsers\n generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = Math.random() * 16 | 0;\n const v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n const playerUrl = options.playerUrl;\n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n async play(options) {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto'\n });\n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0'\n });\n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video' }],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n return;\n }\n // Setup unified event handlers to match iOS and Android\n setupEventHandlers() {\n if (!this.jwPlayerInstance)\n return;\n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n // Error event\n this.jwPlayerInstance.on('error', (error) => {\n this.notifyListeners('error', {\n message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',\n code: (error === null || error === void 0 ? void 0 : error.code) || -1\n });\n });\n // Play event \n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n // Seek event\n this.jwPlayerInstance.on('seek', (event) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset\n });\n });\n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration\n });\n lastTimeUpdate = now;\n }\n });\n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event) => {\n var _a;\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || ''\n });\n });\n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls\n });\n });\n }\n async pause() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n async stop() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n if (this.overlayDiv && this.overlayDiv.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n async seekTo(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n async setVolume(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n async getPosition() {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n async getState() {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n switch (jwState) {\n case 'buffering':\n state = 1;\n break;\n case 'playing':\n state = 2;\n break;\n case 'paused':\n state = 3;\n break;\n default: state = 0; // idle\n }\n return { state };\n }\n async setSpeed(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n async setPlaylistIndex(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylist(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylistWithItems(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n async getAudioTracks() {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n async getCurrentAudioTrack() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentAudioTrack(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async getCaptions() {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n async getCurrentCaptions() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentCaptions(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async currentPlaylist() {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n async resume() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICHD;IAEO,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B;IACA,QAAQ,IAAI,CAAC,UAAU,GAAG,IAAI;IAC9B;IACA,QAAQ,IAAI,CAAC,gBAAgB,GAAG,IAAI;IACpC;IACA;IACA,IAAI,YAAY,GAAG;IACnB,QAAQ,OAAO,sCAAsC,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;IACpF,YAAY,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GA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AK,CAAC;IACnE,YAAY;IACZ;IACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;IAC5C;IACA,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;IACnC,YAAY,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE;IACtD;IACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;IAC5C;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,IAAI,IAAI,CAAC,gBAAgB,EAAE;IACnC,YAAY,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE;IACxC;IACA,YAAY;IACZ;IACA,QAAQ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;IAC5C;IACA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst JwPlayer = registerPlugin('JwPlayer', {\n web: () => import('./web').then((m) => new m.JwPlayerWeb()),\n});\nexport * from './definitions';\nexport { JwPlayer };\n//# sourceMappingURL=index.js.map","/// <reference types=\"jwplayer\" />\nimport { WebPlugin } from '@capacitor/core';\nexport class JwPlayerWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n // Track if our overlay is currently displayed\n this.overlayDiv = null;\n // Store JW Player instance\n this.jwPlayerInstance = null;\n }\n // Generate a UUID that works in all browsers\n generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n async initialize(options) {\n console.log('INITIALIZE', options);\n if (!options.playerUrl) {\n throw new Error('playerUrl is required for web implementation');\n }\n const playerUrl = options.playerUrl;\n await new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = playerUrl;\n script.onload = () => resolve(null);\n script.onerror = () => reject(new Error('Failed to load JW Player script'));\n document.head.appendChild(script);\n });\n // Check if jwplayer() is available globally\n if (typeof window.jwplayer !== 'function') {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n }\n async play(options) {\n if (!window.jwplayer) {\n throw new Error('JW Player script failed to load properly - jwplayer() function not found');\n }\n // Create fullscreen overlay div\n if (this.overlayDiv) {\n // Remove existing overlay if it exists\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // Create new overlay div (this will be our red background container)\n this.overlayDiv = document.createElement('div');\n // Style the outer overlay to take up 100% of screen\n Object.assign(this.overlayDiv.style, {\n position: 'fixed',\n top: '0',\n left: '0',\n width: '100%',\n height: '100%',\n zIndex: '9999',\n display: 'flex',\n });\n // Create the inner div for the player\n const playerDiv = document.createElement('div');\n const uniqueId = this.generateUUID();\n const id = `jw-player-${uniqueId}`;\n playerDiv.id = id;\n // Style the inner player div\n Object.assign(playerDiv.style, {\n width: '100%',\n height: '100%',\n margin: '0 auto',\n });\n // Create close (X) button\n const closeButton = document.createElement('button');\n closeButton.textContent = 'X';\n Object.assign(closeButton.style, {\n position: 'absolute',\n top: '10px',\n left: '10px',\n background: 'rgba(0, 0, 0, 0.5)',\n color: 'white',\n border: 'none',\n borderRadius: '50%',\n width: '30px',\n height: '30px',\n fontSize: '16px',\n fontWeight: 'bold',\n cursor: 'pointer',\n zIndex: '10000',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n padding: '0',\n });\n // Add click handler to close button\n closeButton.addEventListener('click', () => {\n var _a;\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n }\n if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n this.notifyListeners('playerDismissed', {});\n }\n });\n // Append inner div to the red overlay\n this.overlayDiv.appendChild(playerDiv);\n // Append close button to overlay\n this.overlayDiv.appendChild(closeButton);\n // Append outer div to body\n document.body.appendChild(this.overlayDiv);\n // Setup player on the inner div\n this.jwPlayerInstance = jwplayer(id).setup({\n playlist: options.mediaType === 'playlist' ? options.mediaUrl : [{ file: options.mediaUrl, title: 'Video' }],\n width: '100%',\n height: '100%',\n autostart: options.autostart || false,\n controls: true,\n displaytitle: false,\n });\n // Add unified event handlers to match iOS and Android\n this.setupEventHandlers();\n return;\n }\n // Setup unified event handlers to match iOS and Android\n setupEventHandlers() {\n if (!this.jwPlayerInstance)\n return;\n // Ready event\n this.jwPlayerInstance.on('ready', () => {\n this.notifyListeners('ready', {});\n });\n // Error event\n this.jwPlayerInstance.on('error', (error) => {\n this.notifyListeners('error', {\n message: (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error',\n code: (error === null || error === void 0 ? void 0 : error.code) || -1,\n });\n });\n // Play event\n this.jwPlayerInstance.on('play', () => {\n this.notifyListeners('play', { reason: 'external' });\n });\n // Pause event\n this.jwPlayerInstance.on('pause', () => {\n this.notifyListeners('pause', { reason: 'external' });\n });\n // Complete event\n this.jwPlayerInstance.on('complete', () => {\n this.notifyListeners('complete', {});\n });\n // Seek event\n this.jwPlayerInstance.on('seek', (event) => {\n this.notifyListeners('seek', {\n position: event.position,\n offset: event.offset,\n });\n });\n // Time event (throttled to not fire too often)\n let lastTimeUpdate = 0;\n this.jwPlayerInstance.on('time', (event) => {\n const now = Date.now();\n // Throttle to once per second max\n if (now - lastTimeUpdate > 1000) {\n this.notifyListeners('time', {\n position: event.position,\n duration: event.duration,\n });\n lastTimeUpdate = now;\n }\n });\n // Playlist item event\n this.jwPlayerInstance.on('playlistItem', (event) => {\n var _a;\n this.notifyListeners('playlistItem', {\n index: event.index,\n title: ((_a = event.item) === null || _a === void 0 ? void 0 : _a.title) || '',\n });\n });\n // Playlist complete event\n this.jwPlayerInstance.on('playlistComplete', () => {\n this.notifyListeners('playlistComplete', {});\n });\n // Controls visibility event\n this.jwPlayerInstance.on('controls', (event) => {\n this.notifyListeners('controlsChanged', {\n visible: event.controls,\n });\n });\n }\n async pause() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.pause();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n async stop() {\n var _a;\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.remove();\n this.jwPlayerInstance = null;\n if ((_a = this.overlayDiv) === null || _a === void 0 ? void 0 : _a.parentNode) {\n document.body.removeChild(this.overlayDiv);\n this.overlayDiv = null;\n }\n // The complete event will be triggered by the JW Player event handler,\n // but since we're removing the player instance, we need to send it manually here\n this.notifyListeners('playerDismissed', {});\n return;\n }\n throw new Error('Player not active');\n }\n async seekTo(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.seek(options.time);\n return;\n }\n throw new Error('Player not active');\n }\n async setVolume(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setVolume(options.volume);\n return;\n }\n throw new Error('Player not active');\n }\n async getPosition() {\n if (this.jwPlayerInstance) {\n return { position: this.jwPlayerInstance.getPosition() };\n }\n throw new Error('Player not active');\n }\n async getState() {\n if (!this.jwPlayerInstance) {\n // IDLE (no player)\n return { state: 0 };\n }\n // Convert JW Player state to our state format\n // jwplayer: BUFFERING(3), IDLE(0), COMPLETE(4), PAUSED(2), PLAYING(1)\n // our API: IDLE(0), BUFFERING(1), PLAYING(2), PAUSED(3), COMPLETE(4)\n const jwState = this.jwPlayerInstance.getState();\n let state = 0;\n switch (jwState) {\n case 'buffering':\n state = 1;\n break;\n case 'playing':\n state = 2;\n break;\n case 'paused':\n state = 3;\n break;\n default:\n state = 0; // idle\n }\n return { state };\n }\n async setSpeed(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setPlaybackRate(options.speed);\n return;\n }\n throw new Error('Player not active');\n }\n async setPlaylistIndex(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.playlistItem(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylist(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlistUrl);\n return;\n }\n throw new Error('Player not active');\n }\n async loadPlaylistWithItems(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.load(options.playlist);\n return;\n }\n throw new Error('Player not active');\n }\n async getAudioTracks() {\n if (this.jwPlayerInstance) {\n const tracks = this.jwPlayerInstance.getAudioTracks();\n return { tracks };\n }\n throw new Error('Player not active');\n }\n async getCurrentAudioTrack() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentAudioTrack();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentAudioTrack(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentAudioTrack(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async getCaptions() {\n if (this.jwPlayerInstance) {\n const captions = this.jwPlayerInstance.getCaptionsList();\n return { captions };\n }\n throw new Error('Player not active');\n }\n async getCurrentCaptions() {\n if (this.jwPlayerInstance) {\n const index = this.jwPlayerInstance.getCurrentCaptions();\n return { index };\n }\n throw new Error('Player not active');\n }\n async setCurrentCaptions(options) {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.setCurrentCaptions(options.index);\n return;\n }\n throw new Error('Player not active');\n }\n async currentPlaylist() {\n if (this.jwPlayerInstance) {\n return this.jwPlayerInstance.getPlaylist();\n }\n throw new Error('Player not active');\n }\n async resume() {\n if (this.jwPlayerInstance) {\n this.jwPlayerInstance.play();\n // Event is fired by the event handler\n return;\n }\n throw new Error('Player not active');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,QAAQ,GAAGA,mBAAc,CAAC,UAAU,EAAE;IAC5C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/D,CAAC;;ICHD;IAEO,MAAM,WAAW,SAASC,cAAS,CAAC;IAC3C,IAAI,WAAW,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development Guide
|
|
8
7
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
@@ -16,7 +15,8 @@ protocol CallbackHandler {
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
@objc(JwPlayerPlugin)
|
|
19
|
-
public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin
|
|
18
|
+
public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
19
|
+
// public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin, GCKLoggerDelegate {
|
|
20
20
|
public let identifier = "JwPlayerPlugin"
|
|
21
21
|
public let jsName = "JwPlayer"
|
|
22
22
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
@@ -46,8 +46,8 @@ public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin, GCKLoggerDelegate {
|
|
|
46
46
|
override public func load() {
|
|
47
47
|
// Configure the audio session when the plugin loads
|
|
48
48
|
setupAudioSession()
|
|
49
|
-
print("[JWPlayer] Plugin loaded. Note: Chromecast is initialized in AppDelegate.")
|
|
50
|
-
initializeChromecast()
|
|
49
|
+
// print("[JWPlayer] Plugin loaded. Note: Chromecast is initialized in AppDelegate.")
|
|
50
|
+
// initializeChromecast()
|
|
51
51
|
super.load()
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -63,46 +63,46 @@ public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin, GCKLoggerDelegate {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
private func initializeChromecast() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public func logMessage(_ message: String, at level: GCKLoggerLevel, fromFunction function: String, location: String) {
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@objc func initialize(_ call: CAPPluginCall) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
66
|
+
// private func initializeChromecast() {
|
|
67
|
+
// print("[ChromecastDebug] Starting Chromecast initialization")
|
|
68
|
+
// let kReceiverAppID = "CC1AD845" // Custom App ID for Chromecast
|
|
69
|
+
// let discoveryCriteria = GCKDiscoveryCriteria(applicationID: kReceiverAppID)
|
|
70
|
+
// let options = GCKCastOptions(discoveryCriteria: discoveryCriteria)
|
|
71
|
+
// options.physicalVolumeButtonsWillControlDeviceVolume = true
|
|
72
|
+
// options.disableDiscoveryAutostart = false
|
|
73
|
+
// print("[ChromecastDebug] Setting custom options for Chromecast")
|
|
74
|
+
// do {
|
|
75
|
+
// GCKCastContext.setSharedInstanceWith(options)
|
|
76
|
+
// print("[ChromecastDebug] Chromecast context initialized with App ID: \(kReceiverAppID)")
|
|
77
|
+
// } catch {
|
|
78
|
+
// print("[ChromecastDebug] Error initializing Chromecast context: \(error.localizedDescription)")
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
// let filter = GCKLoggerFilter.init()
|
|
82
|
+
// filter.minimumLevel = .verbose
|
|
83
|
+
// GCKLogger.sharedInstance().filter = filter
|
|
84
|
+
// GCKLogger.sharedInstance().delegate = self
|
|
85
|
+
// print("[ChromecastDebug] Logger initialized")
|
|
86
|
+
// }
|
|
87
|
+
|
|
88
|
+
// public func logMessage(_ message: String, at level: GCKLoggerLevel, fromFunction function: String, location: String) {
|
|
89
|
+
// print(function + " - " + message)
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
// @objc func initialize(_ call: CAPPluginCall) {
|
|
93
|
+
// print("[JWPlayer] initialize called")
|
|
94
|
+
// guard let licenseKey = call.getString("licenseKey") else {
|
|
95
|
+
// print("[JWPlayer] Error: licenseKey is missing")
|
|
96
|
+
// call.reject("licenseKey is required for initialize")
|
|
97
|
+
// return
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
// print("[JWPlayer] Setting license key")
|
|
101
|
+
// JWPlayerKitLicense.setLicenseKey(licenseKey)
|
|
102
|
+
// print("[JWPlayer] License key set successfully")
|
|
103
|
+
|
|
104
|
+
// call.resolve()
|
|
105
|
+
// }
|
|
106
106
|
|
|
107
107
|
@objc func play(_ call: CAPPluginCall) {
|
|
108
108
|
print("[JWPlayer] play called with options: \(call.options)")
|
|
@@ -114,7 +114,7 @@ public class JwPlayerPlugin: CAPPlugin, CAPBridgedPlugin, GCKLoggerDelegate {
|
|
|
114
114
|
|
|
115
115
|
guard let mediaUrl = URL(string: mediaUrlStr) else {
|
|
116
116
|
print("[JWPlayer] Error: mediaUrl is invalid URL: \(mediaUrlStr)")
|
|
117
|
-
call.reject("mediaUrl is invalid URL")
|
|
117
|
+
call.reject("mediaUrl is invalid URL: \(mediaUrlStr)")
|
|
118
118
|
return
|
|
119
119
|
}
|
|
120
120
|
|