@clockworkdog/cogs-client 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/AudioPlayer.js +1 -0
- package/dist/VideoPlayer.js +4 -2
- package/dist/browser/index.js +1485 -1472
- package/dist/helpers/urls.js +3 -3
- package/dist/index.js +17 -7
- package/dist/types/CogsPluginManifest.d.ts +2 -0
- package/package.json +39 -38
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Create content for your COGS Media Master
|
|
4
4
|
|
|
5
|
-
## [Documentation](https://clockwork-dog.github.io/cogs-
|
|
5
|
+
## [Documentation](https://clockwork-dog.github.io/cogs-sdk/javascript/)
|
|
6
6
|
|
|
7
7
|
## Add to your project
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@ yarn add @clockworkdog/cogs-client
|
|
|
32
32
|
|
|
33
33
|
### Create a `cogs-plugin-manifest.js` file
|
|
34
34
|
|
|
35
|
-
See [
|
|
35
|
+
See [CogsPluginManifestJson](https://clockwork-dog.github.io/cogs-sdk/javascript/interfaces/CogsPluginManifestJson.html) for details of what to include.
|
|
36
36
|
|
|
37
37
|
If using Typescript set `"allowJs": true` in your `tsconfig.json`.
|
|
38
38
|
|
|
@@ -107,7 +107,7 @@ import { CogsConnection, CogsAudioPlayer } from '@clockworkdog/cogs-client';
|
|
|
107
107
|
|
|
108
108
|
### Connect to COGS
|
|
109
109
|
|
|
110
|
-
Initialize a [CogsConnection](https://clockwork-dog.github.io/cogs-
|
|
110
|
+
Initialize a [CogsConnection](https://clockwork-dog.github.io/cogs-sdk/javascript/classes/CogsConnection.html) with the manifest you created above.
|
|
111
111
|
|
|
112
112
|
```ts
|
|
113
113
|
let connected = false;
|
|
@@ -152,14 +152,14 @@ You can save arbitrary data to COGS which will be restored when reconnecting wit
|
|
|
152
152
|
```ts
|
|
153
153
|
const cogsConnection = new CogsConnection(manifest, {
|
|
154
154
|
// Initial items in the store
|
|
155
|
-
'my-key': { foo: 0, bar: '' }
|
|
155
|
+
'my-key': { foo: 0, bar: '' },
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
// Update the store
|
|
159
159
|
cogsConnection.store.setItems({ 'my-key': { foo: 1, bar: 'two' } });
|
|
160
160
|
|
|
161
161
|
// Get item from data store
|
|
162
|
-
cogsConnection.store.items.getItem('my-key')
|
|
162
|
+
cogsConnection.store.items.getItem('my-key');
|
|
163
163
|
|
|
164
164
|
// Listen for data changes
|
|
165
165
|
cogsConnection.store.addEventListener('item', ({ key, value }) => {
|
|
@@ -182,7 +182,7 @@ Add `audio` to `cogs-plugin-manifest.js`:
|
|
|
182
182
|
}
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
Add [CogsAudioPlayer](https://clockwork-dog.github.io/cogs-
|
|
185
|
+
Add [CogsAudioPlayer](https://clockwork-dog.github.io/cogs-sdk/javascript/classes/CogsAudioPlayer.html) to your page:
|
|
186
186
|
|
|
187
187
|
```ts
|
|
188
188
|
const audioPlayer = new CogsAudioPlayer(cogsConnection);
|
package/dist/AudioPlayer.js
CHANGED
|
@@ -5,6 +5,7 @@ const DEBUG = false;
|
|
|
5
5
|
// Check an iOS-only property (See https://developer.mozilla.org/en-US/docs/Web/API/Navigator#non-standard_properties)
|
|
6
6
|
const IS_IOS = typeof navigator.standalone !== 'undefined';
|
|
7
7
|
class AudioPlayer {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
9
|
constructor(cogsConnection) {
|
|
9
10
|
this.cogsConnection = cogsConnection;
|
|
10
11
|
this.eventTarget = new EventTarget();
|
package/dist/VideoPlayer.js
CHANGED
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const VideoState_1 = require("./types/VideoState");
|
|
4
4
|
const DEFAULT_PARENT_ELEMENT = document.body;
|
|
5
5
|
class VideoPlayer {
|
|
6
|
-
constructor(
|
|
6
|
+
constructor(
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
cogsConnection, parentElement = DEFAULT_PARENT_ELEMENT) {
|
|
7
9
|
this.cogsConnection = cogsConnection;
|
|
8
10
|
this.eventTarget = new EventTarget();
|
|
9
11
|
this.globalVolume = 1;
|
|
@@ -262,7 +264,7 @@ class VideoPlayer {
|
|
|
262
264
|
loop: (_d = (_c = this.videoClipPlayers[this.activeClip.path].videoElement) === null || _c === void 0 ? void 0 : _c.loop) !== null && _d !== void 0 ? _d : false,
|
|
263
265
|
volume: ((_e = this.videoClipPlayers[this.activeClip.path].videoElement) === null || _e === void 0 ? void 0 : _e.muted)
|
|
264
266
|
? 0
|
|
265
|
-
: (_g = (_f = this.videoClipPlayers[this.activeClip.path].videoElement) === null || _f === void 0 ? void 0 : _f.volume) !== null && _g !== void 0 ? _g : 0,
|
|
267
|
+
: ((_g = (_f = this.videoClipPlayers[this.activeClip.path].videoElement) === null || _f === void 0 ? void 0 : _f.volume) !== null && _g !== void 0 ? _g : 0),
|
|
266
268
|
}
|
|
267
269
|
: undefined,
|
|
268
270
|
};
|