student:demo
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| student:demo [2020/04/13 18:54] – jas | student:demo [2020/04/13 19:40] (current) – jonathan | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| {{: | {{: | ||
| - | < | + | [[https:// |
| - | + | ||
| - | <div id=" | + | |
| - | < | + | **What is FizzBuzz**? Write a program that prints the numbers from 1 to 100. But for multiples of three print " |
| - | // 2. This code loads the IFrame Player API code asynchronously. | + | |
| - | var tag = document.createElement(' | + | |
| - | tag.src = "https://www.youtube.com/iframe_api"; | + | See the post [[https://blog.codinghorror.com/why-cant-programmers-program/ |
| - | var firstScriptTag = document.getElementsByTagName(' | + | |
| - | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | + | |
| - | // 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(); | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| Line 78: | Line 37: | ||
| * [[https:// | * [[https:// | ||
| + | < | ||
| + | <iframe width=" | ||
| + | src=" | ||
| + | frameborder=" | ||
| + | encrypted-media; | ||
| + | allowfullscreen> | ||
| + | </ | ||
| + | </ | ||
student/demo.1586804069.txt.gz · Last modified: by jas
