aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc
diff options
context:
space:
mode:
Diffstat (limited to 'support/doc')
-rw-r--r--support/doc/api/embeds.md21
1 files changed, 20 insertions, 1 deletions
diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md
index c2317a030..ca480006d 100644
--- a/support/doc/api/embeds.md
+++ b/support/doc/api/embeds.md
@@ -21,6 +21,24 @@ Now just use the `PeerTubePlayer` class exported by the module:
21```typescript 21```typescript
22import { PeerTubePlayer } from '@peertube/embed-api' 22import { PeerTubePlayer } from '@peertube/embed-api'
23 23
24...
25```
26
27Or use the minified build from NPM CDN in your HTML file:
28
29```
30<script src="https://unpkg.com/@peertube/embed-api@0.0.1/build/player.min.js"></script>
31
32<script>
33 const PeerTubePlayer = window['PeerTubePlayer']
34
35 ...
36</script>
37```
38
39Then you can instantiate the player:
40
41```typescript
24let player = new PeerTubePlayer(document.querySelector('iframe')) 42let player = new PeerTubePlayer(document.querySelector('iframe'))
25await player.ready // wait for the player to be ready 43await player.ready // wait for the player to be ready
26 44
@@ -56,7 +74,7 @@ Get the available resolutions. A `PeerTubeResolution` looks like:
56{ 74{
57 "id": 3, 75 "id": 3,
58 "label": "720p", 76 "label": "720p",
59 "src": "//src-url-here", 77 "height": "720",
60 "active": true 78 "active": true
61} 79}
62``` 80```
@@ -87,6 +105,7 @@ Set the playback volume. Value should be between `0` and `1`.
87## `getVolume(): Promise<number>` 105## `getVolume(): Promise<number>`
88 106
89Get the playback volume. Returns a value between `0` and `1`. 107Get the playback volume. Returns a value between `0` and `1`.
108
90# Events 109# Events
91 110
92You can subscribe to events by using `addEventListener()`. See above for details. 111You can subscribe to events by using `addEventListener()`. See above for details.