aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/doc/api/embeds.md
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-17 16:17:22 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 10:14:25 +0100
commit03d641a0d7f996de44ec898ad739bc4050514ba1 (patch)
treedc8d36a945133fdc91fa279b9c97a22f1ec11465 /support/doc/api/embeds.md
parentc026a2e67357bd4bd4fcc4c10f8c5cd4749435c9 (diff)
downloadPeerTube-03d641a0d7f996de44ec898ad739bc4050514ba1.tar.gz
PeerTube-03d641a0d7f996de44ec898ad739bc4050514ba1.tar.zst
PeerTube-03d641a0d7f996de44ec898ad739bc4050514ba1.zip
Add embed api build
Diffstat (limited to 'support/doc/api/embeds.md')
-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.