File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed
Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -8,22 +8,28 @@ This is an npm module version of the YouTube Player API for IFrame embeds. It au
88npm 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
You can’t perform that action at this time.
0 commit comments