jwplayer-capacitor
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -42,3 +42,3 @@ { | ||
"name": "create", | ||
"signature": "(options: { divId?: string; videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; captions?: Array<JWPlayerMediaTrack>; front?: boolean; }) => any", | ||
"signature": "(options: { webConfiguration?: { container: string; properties?: any; }; nativeConfiguration?: { videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; front?: boolean; }; captions?: JWPlayerMediaTrack[]; }) => any", | ||
"parameters": [ | ||
@@ -48,3 +48,3 @@ { | ||
"docs": "", | ||
"type": "{ divId?: string | undefined; videoURL: string; posterURL?: string | undefined; forceFullScreenOnLandscape?: boolean | undefined; x: number; y: number; width: number; height: number; captions?: any; front?: boolean | undefined; }" | ||
"type": "{ webConfiguration?: { container: string; properties?: any; } | undefined; nativeConfiguration?: { videoURL: string; posterURL?: string | undefined; forceFullScreenOnLandscape?: boolean | undefined; x: number; y: number; width: number; height: number; front?: boolean | undefined; } | undefined; captions?: {} | undefined; }" | ||
} | ||
@@ -56,3 +56,2 @@ ], | ||
"complexTypes": [ | ||
"Array", | ||
"JWPlayerMediaTrack" | ||
@@ -84,3 +83,3 @@ ], | ||
{ | ||
"name": "url", | ||
"name": "file", | ||
"tags": [], | ||
@@ -87,0 +86,0 @@ "docs": "", |
export interface JWPlayerMediaTrack { | ||
url: string; | ||
file: string; | ||
label: string; | ||
@@ -19,14 +19,19 @@ default: boolean; | ||
create(options: { | ||
divId?: string; | ||
videoURL: string; | ||
posterURL?: string; | ||
forceFullScreenOnLandscape?: boolean; | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
captions?: Array<JWPlayerMediaTrack>; | ||
front?: boolean; | ||
webConfiguration?: { | ||
container: string; | ||
properties?: any; | ||
}; | ||
nativeConfiguration?: { | ||
videoURL: string; | ||
posterURL?: string; | ||
forceFullScreenOnLandscape?: boolean; | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
front?: boolean; | ||
}; | ||
captions?: JWPlayerMediaTrack[]; | ||
}): Promise<any>; | ||
remove(): Promise<any>; | ||
} |
import { WebPlugin } from '@capacitor/core'; | ||
import { JWPlayerMediaTrack } from '.'; | ||
import type { JWPlayerMediaTrack } from '.'; | ||
import type { JWPlayerPlugin } from './definitions'; | ||
@@ -18,15 +18,20 @@ export declare class JWPlayerWeb extends WebPlugin implements JWPlayerPlugin { | ||
}): Promise<any>; | ||
remove(): Promise<any>; | ||
create(options: { | ||
divId?: string; | ||
videoURL: string; | ||
posterURL?: string; | ||
forceFullScreenOnLandscape?: boolean; | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
captions?: Array<JWPlayerMediaTrack>; | ||
front?: boolean; | ||
webConfiguration?: { | ||
container: string; | ||
properties?: any; | ||
}; | ||
nativeConfiguration?: { | ||
videoURL: string; | ||
posterURL?: string; | ||
forceFullScreenOnLandscape?: boolean; | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
front?: boolean; | ||
}; | ||
captions?: JWPlayerMediaTrack[]; | ||
}): Promise<any>; | ||
remove(): Promise<any>; | ||
} |
@@ -23,61 +23,2 @@ import { WebPlugin } from '@capacitor/core'; | ||
} | ||
async create(options) { | ||
if (this.isInit) { | ||
setTimeout(() => { | ||
var _a, _b; | ||
if (this.playerInstance === undefined) { | ||
this.playerInstance = jwplayer(options.divId); | ||
this.playerInstance.setup({ | ||
"file": options.videoURL, | ||
"image": options.posterURL, | ||
"height": options.height, | ||
"width": options.width, | ||
"tracks": (_a = options.captions) === null || _a === void 0 ? void 0 : _a.map(item => { | ||
return { | ||
'kind': "captions", | ||
'file': item.url, | ||
'label': item.label | ||
}; | ||
}) | ||
}); | ||
} | ||
else { | ||
this.playerInstance.load({ | ||
"file": options.videoURL, | ||
"image": options.posterURL, | ||
"height": options.height, | ||
"width": options.width, | ||
"tracks": (_b = options.captions) === null || _b === void 0 ? void 0 : _b.map(item => { | ||
return { | ||
'kind': "captions", | ||
'file': item.url, | ||
'label': item.label | ||
}; | ||
}) | ||
}); | ||
} | ||
/*this.divId = options.divId; | ||
console.log('Creating', options); | ||
console.log(jwplayer); | ||
jwplayer(this.divId ).setup({ | ||
"file": options.videoURL, | ||
"image": options.posterURL, | ||
"height": options.height, | ||
"width": options.width, | ||
"tracks": options.captions?.map(item => { | ||
return { | ||
'kind': "captions", | ||
'file': item.url, | ||
'label': item.label | ||
} | ||
}) | ||
}); | ||
console.log(jwplayer().getState());*/ | ||
}, 1000); | ||
} | ||
else { | ||
console.error("Jwplayer has not initialized"); | ||
} | ||
} | ||
async remove() { | ||
@@ -91,3 +32,28 @@ if (this.playerInstance) { | ||
} | ||
async create(options) { | ||
var _a, _b, _c, _d; | ||
if (this.isInit && options.webConfiguration) { | ||
if (this.playerInstance === undefined) { | ||
this.playerInstance = jwplayer(options.webConfiguration.container); | ||
this.playerInstance.setup(Object.assign(Object.assign({}, (_a = options.webConfiguration.properties) !== null && _a !== void 0 ? _a : {}), { "tracks": (_b = options.captions) === null || _b === void 0 ? void 0 : _b.map(item => { | ||
return { | ||
'kind': "captions", | ||
'file': item.file, | ||
'label': item.label | ||
}; | ||
}) })); | ||
} | ||
else { | ||
this.playerInstance.load(Object.assign(Object.assign({}, (_c = options.webConfiguration.properties) !== null && _c !== void 0 ? _c : {}), { "tracks": (_d = options.captions) === null || _d === void 0 ? void 0 : _d.map(item => { | ||
return { | ||
'kind': "captions", | ||
'file': item.file, | ||
'label': item.label | ||
}; | ||
}) })); | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=web.js.map |
{ | ||
"name": "jwplayer-capacitor", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Integration of JWPlayer Web and Mobile SDKs with Capacitor", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
@@ -60,8 +60,8 @@ # jwplayer-capacitor | ||
```typescript | ||
create(options: { divId?: string; videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; captions?: Array<JWPlayerMediaTrack>; front?: boolean; }) => any | ||
create(options: { webConfiguration?: { container: string; properties?: any; }; nativeConfiguration?: { videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; front?: boolean; }; captions?: JWPlayerMediaTrack[]; }) => any | ||
``` | ||
| Param | Type | | ||
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **`options`** | <code>{ divId?: string; videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; captions?: any; front?: boolean; }</code> | | ||
| Param | Type | | ||
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **`options`** | <code>{ webConfiguration?: { container: string; properties?: any; }; nativeConfiguration?: { videoURL: string; posterURL?: string; forceFullScreenOnLandscape?: boolean; x: number; y: number; width: number; height: number; front?: boolean; }; captions?: {}; }</code> | | ||
@@ -91,3 +91,3 @@ **Returns:** <code>any</code> | ||
| ------------- | -------------------- | | ||
| **`url`** | <code>string</code> | | ||
| **`file`** | <code>string</code> | | ||
| **`label`** | <code>string</code> | | ||
@@ -94,0 +94,0 @@ | **`default`** | <code>boolean</code> | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1588212
5406