]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - support/doc/api/embeds.md
Add embed api build
[github/Chocobozzz/PeerTube.git] / support / doc / api / embeds.md
index 3a35a539c1d99d49d3d0ef87d63bad8453aea824..ca480006d9c603ea13df5583c053454655a1ff95 100644 (file)
@@ -21,6 +21,24 @@ Now just use the `PeerTubePlayer` class exported by the module:
 ```typescript
 import { PeerTubePlayer } from '@peertube/embed-api'
 
+...
+```
+
+Or use the minified build from NPM CDN in your HTML file:
+
+```
+<script src="https://unpkg.com/@peertube/embed-api@0.0.1/build/player.min.js"></script>
+
+<script>
+  const PeerTubePlayer = window['PeerTubePlayer']
+
+  ...
+</script>
+```
+
+Then you can instantiate the player:
+
+```typescript
 let player = new PeerTubePlayer(document.querySelector('iframe'))
 await player.ready // wait for the player to be ready
 
@@ -56,7 +74,7 @@ Get the available resolutions. A `PeerTubeResolution` looks like:
 {
     "id": 3,
     "label": "720p",
-    "src": "//src-url-here",
+    "height": "720",
     "active": true
 }
 ```
@@ -87,6 +105,7 @@ Set the playback volume. Value should be between `0` and `1`.
 ## `getVolume(): Promise<number>`
 
 Get the playback volume. Returns a value between `0` and `1`.
+
 # Events
 
 You can subscribe to events by using `addEventListener()`. See above for details.
@@ -119,4 +138,8 @@ Fired when playback transitions between states, such as `pausing` and `playing`.
 
 ## Event `resolutionUpdate`
 
-Fired when the available resolutions have changed, or when the currently selected resolution has changed. Listener should call `getResolutions()` to get the updated information.
\ No newline at end of file
+Fired when the available resolutions have changed, or when the currently selected resolution has changed. Listener should call `getResolutions()` to get the updated information.
+
+## Event `volumeChange`
+
+Fired when the player volume changed.