-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i added in the DB, profile page and upload page, a select combo for video type. Add Vimeo video resource. now we have the two more commons video platforms.
- Loading branch information
1 parent
977533b
commit 2aa101d
Showing
5 changed files
with
42 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
<script> | ||
// 2. This code loads the IFrame Player API code asynchronously. | ||
var tag = document.createElement('script'); | ||
tag.src = "https://www.youtube.com/iframe_api"; | ||
var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
// 3. This function creates an <iframe> (and YouTube player) | ||
// after the API code downloads. | ||
var player; | ||
function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '360', width: '640', videoId: '<%= image.youtubeid %>', events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange }}); } | ||
// 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's state changes. | ||
// 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, 6000); done = true; }} | ||
function stopVideo() { player.stopVideo(); } | ||
</script> | ||
<% if (typeof image.video_id === 'string' && image.video_id.length !== 0 && typeof image.video_type === 'number' && image.video_type.length !== 0) {%> | ||
<% if (image.video_type === 1) {%> <!-- Youtube --> | ||
<script> | ||
// 2. This code loads the IFrame Player API code asynchronously. | ||
var tag = document.createElement('script'); | ||
tag.src = "https://www.youtube.com/iframe_api"; | ||
var firstScriptTag = document.getElementsByTagName('script')[0]; | ||
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | ||
// 3. This function creates an <iframe> (and YouTube player) | ||
// after the API code downloads. | ||
var player; | ||
function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '360', width: '640', videoId: '<%= image.video_id %>', events: {'onReady': onPlayerReady,'onStateChange': onPlayerStateChange }}); } | ||
// 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's state changes. | ||
// 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, 6000); done = true; }} | ||
function stopVideo() { player.stopVideo(); } | ||
</script> | ||
<% } %> | ||
<% } %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters