Skip to content

Commit 9064b7b

Browse files
committed
doc: update the doc
1 parent bfaa445 commit 9064b7b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,28 @@ This is an npm module version of the YouTube Player API for IFrame embeds. It au
88
npm install youtube-iframe-api-module
99
```
1010

11-
12-
The `onYouTubeIframeAPIReady()` method is called when the YouTube IFrame API has loaded and is ready to use.
11+
The `onYouTubeIframeAPIReady()` method is called when the YouTube IFrame API has finished loading and is ready to be used.
1312

1413
```js
15-
import { onYouTubeIframeAPIReady } from 'youtube-iframe-api-module';
14+
import { loadScript } from 'youtube-iframe-api-module';
15+
16+
17+
loadScript(() => {
18+
// Player 1
19+
const player = new YT.Player('player-one', {
20+
height: '390',
21+
width: '640',
22+
videoId: 'M7lc1UVf-VE'
23+
});
24+
})
1625

17-
onYouTubeIframeAPIReady(() => {
18-
// Create a new YouTube player with IFrame API
19-
const player = new YT.Player('player', {
26+
loadScript(() => {
27+
// Player 2
28+
const player = new YT.Player('player-two', {
2029
height: '390',
2130
width: '640',
22-
videoId: 'M7lc1UVf-VE',
23-
playerVars: {
24-
playsinline: 1
25-
},
31+
videoId: 'M7lc1UVf-VE'
2632
});
27-
});
33+
})
2834
```
2935

0 commit comments

Comments
 (0)