-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prettify
- Loading branch information
Showing
1 changed file
with
60 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Load Video from URL Parameter</title> | ||
</head> | ||
<body> | ||
<p id="no-video-url" style="display:none;">Video URL missing, try with suffix : | ||
<a href="./SignItVideosIframe.html?twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm"> | ||
?twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm | ||
</a> | ||
</head> | ||
|
||
<body> | ||
<p id="no-video-url" style="display:none;">Video URL missing, try with suffix : | ||
<a href="./SignItVideosIframe.html?width=250&twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm"> | ||
?twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm | ||
</a> | ||
</p> | ||
<video id="signitVideoElement" controls="" muted="" preload="auto" autoplay="true" src="videoUrl" width="250" class=""> | ||
Your browser does not support the video tag. | ||
</video> | ||
<script> | ||
<video id="signitVideoElement" controls="" muted="" preload="auto" autoplay="true" src="videoUrl" width="250" class=""> | ||
Your browser does not support the video tag. | ||
</video> | ||
<script> | ||
/* USAGE ******************************************************* */ | ||
// ./SignItVideosIframe.html?twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
// Function to get URL parameters | ||
function getUrlParameter(name) { | ||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); | ||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); | ||
var results = regex.exec(location.search); | ||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); | ||
} | ||
|
||
/* USAGE ******************************************************* */ | ||
// ./SignItVideosIframe.html?twospeed=true&video=https://upload.wikimedia.org/wikipedia/commons/6/63/Lapin_Nm_1_2_1_-_Elix.webm | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
// Function to get URL parameters | ||
function getUrlParameter(name) { | ||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); | ||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); | ||
var results = regex.exec(location.search); | ||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); | ||
} | ||
// Get the video URL from the URL parameter | ||
var videoUrl = getUrlParameter('video'); | ||
// Set the video source if the video URL exists | ||
if (videoUrl) { | ||
document.getElementById('signitVideoElement').src = videoUrl; | ||
} else { | ||
// Show the message if video URL is missing | ||
document.getElementById('no-video-url').style.display = 'block'; | ||
} | ||
|
||
// Get the video URL from the URL parameter | ||
var videoUrl = getUrlParameter('video'); | ||
// Set the video source if the video URL exists | ||
if (videoUrl) { | ||
document.getElementById('signitVideoElement').src = videoUrl; | ||
} else { | ||
// Show the message if video URL is missing | ||
document.getElementById('no-video-url').style.display = 'block'; | ||
} | ||
// Pass size parameter | ||
var width = getUrlParameter('width') || 250; | ||
document.getElementById('signitVideoElement').width = width; | ||
|
||
// Pass size parameter | ||
var width = getUrlParameter('width') || 250; | ||
document.getElementById('signitVideoElement').width = width; | ||
// Pass speed parameter | ||
var speedNormal = getUrlParameter('speedNormal') || 1, | ||
speedSlow = getUrlParameter('speedSlow') || 0.5; | ||
var twospeed = getUrlParameter('twospeed') || true; | ||
|
||
// Pass speed parameter | ||
var speedNormal = getUrlParameter('speedNormal') || 1, | ||
speedSlow = getUrlParameter('speedSlow') || 0.5; | ||
var twospeed = getUrlParameter('twospeed') || true; | ||
|
||
console.log({videoUrl}, {speedNormal}, {speedSlow}, {twospeed}, {width}); | ||
console.log({videoUrl}, {speedNormal}, {speedSlow}, {twospeed}, {width}); | ||
|
||
if ( twospeed === 'true' ) { | ||
document.getElementById('signitVideoElement').addEventListener('ended', function(event) { | ||
// Normal speed just played | ||
if (!this.classList.contains('slow')) { | ||
this.classList.add('slow'); | ||
this.playbackRate = speedSlow; | ||
this.play(); | ||
} | ||
// Slow speed just played | ||
else { | ||
this.classList.remove('slow'); | ||
this.playbackRate = speedNormal; | ||
this.pause(); | ||
} | ||
}) | ||
} | ||
|
||
|
||
}); | ||
</script> | ||
</body> | ||
if (twospeed === 'true') { | ||
document.getElementById('signitVideoElement').addEventListener('ended', function(event) { | ||
// Normal speed just played | ||
if (!this.classList.contains('slow')) { | ||
this.classList.add('slow'); | ||
this.playbackRate = speedSlow; | ||
this.play(); | ||
} | ||
// Slow speed just played | ||
else { | ||
this.classList.remove('slow'); | ||
this.playbackRate = speedNormal; | ||
this.pause(); | ||
} | ||
}) | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
2c6fa56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just prettify