course_outline
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
course_outline [2018/01/03 01:59] – jonathan | course_outline [2018/01/03 02:03] (current) – jonathan | ||
---|---|---|---|
Line 10: | Line 10: | ||
* [[https:// | * [[https:// | ||
- | < | ||
- | <iframe width=" | ||
- | </ | ||
- | < | ||
- | |||
- | <div id=" | ||
- | |||
- | < | ||
- | // 2. This code loads the IFrame Player API code asynchronously. | ||
- | var tag = document.createElement(' | ||
- | |||
- | tag.src = " | ||
- | var firstScriptTag = document.getElementsByTagName(' | ||
- | firstScriptTag.parentNode.insertBefore(tag, | ||
- | |||
- | // 3. This function creates an < | ||
- | // after the API code downloads. | ||
- | var player; | ||
- | function onYouTubeIframeAPIReady() { | ||
- | player = new YT.Player(' | ||
- | height: ' | ||
- | width: ' | ||
- | videoId: ' | ||
- | events: { | ||
- | ' | ||
- | ' | ||
- | } | ||
- | }); | ||
- | } | ||
- | |||
- | // 4. The API will call this function when the video player is ready. | ||
- | function onPlayerReady(event) { | ||
- | event.target.playVideo(); | ||
- | } | ||
- | // 5. The API calls this function when the player' | ||
- | // The function indicates that when playing a video (state=1), | ||
- | // the player should play for six seconds and then stop. | ||
- | var done = false; | ||
- | function onPlayerStateChange(event) { | ||
- | if (event.data == YT.PlayerState.PLAYING && !done) { | ||
- | setTimeout(stopVideo, | ||
- | done = true; | ||
- | } | ||
- | } | ||
- | | ||
- | function stopVideo() { | ||
- | player.stopVideo(); | ||
- | } | ||
- | </ | ||
- | </ | ||
===== Reactive systems: Bridge ===== | ===== Reactive systems: Bridge ===== |
course_outline.1514944794.txt.gz · Last modified: 2018/01/03 01:59 by jonathan