2022-11-09 15:44:15 -05:00
|
|
|
<style>
|
2022-11-21 13:39:05 -05:00
|
|
|
.video-player {
|
2022-11-09 15:44:15 -05:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
|
|
|
|
.video-controls {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
width: 100%;
|
|
|
|
height: fit-content;
|
|
|
|
}
|
|
|
|
|
|
|
|
.video-controls p {
|
|
|
|
width: min-content;
|
|
|
|
}
|
|
|
|
|
|
|
|
.media-seek {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.video-controls>* {
|
|
|
|
margin: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.video-controls select,
|
|
|
|
.video-controls button {
|
|
|
|
background-color: transparent;
|
|
|
|
border-color: var(--theme-accent);
|
|
|
|
color: var(--theme-accent);
|
|
|
|
border-radius: 3px;
|
|
|
|
padding: 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon svg {
|
|
|
|
width: 2.25rem;
|
|
|
|
height: fit-content;
|
|
|
|
z-index: -1;
|
|
|
|
background-color: transparent;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon path,
|
|
|
|
.icon rect {
|
|
|
|
stroke: var(--theme-accent);
|
|
|
|
fill: var(--theme-accent);
|
|
|
|
}
|
|
|
|
|
2022-11-22 14:04:18 -05:00
|
|
|
.icon svg circle {
|
2022-11-21 13:39:05 -05:00
|
|
|
stroke: var(--theme-accent);
|
|
|
|
fill: transparent;
|
|
|
|
stroke-width: 6;
|
|
|
|
}
|
|
|
|
.video-player:fullscreen{
|
|
|
|
height:100vh;
|
|
|
|
width:100vw;
|
|
|
|
}
|
|
|
|
.video-player:fullscreen video{
|
|
|
|
max-height: 100vh;
|
|
|
|
height:100%;
|
|
|
|
max-width: 100vw;
|
|
|
|
width: 100vw;
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
|
|
|
</style>
|
2022-11-22 14:04:18 -05:00
|
|
|
<script src="/js/icons.js"></script>
|
2022-11-09 15:44:15 -05:00
|
|
|
<div class="media-container">
|
|
|
|
<div class="video-player">
|
2022-11-21 13:39:05 -05:00
|
|
|
<video preload="metadata" onclick="playthis(event)" onloadedmetadata="setup_video_metadata(event)"
|
|
|
|
ontimeupdate="setup_video_metadata(event)">
|
2023-04-23 23:38:04 -04:00
|
|
|
<source src='{{.Get "src" }}'>
|
2022-11-09 15:44:15 -05:00
|
|
|
</video>
|
|
|
|
<div class="video-controls">
|
2022-11-21 13:39:05 -05:00
|
|
|
<div onclick="toggle_video_play(event)" class="icon">
|
2022-11-22 14:04:18 -05:00
|
|
|
<svg viewBox="0 0 120 120"><circle style="opacity:0.99;fill-opacity:0;stroke-width:6.4;stroke-dasharray:none;stroke-opacity:1" id="path2040" cx="60.062084" cy="62.077591" r="52.403164" /><path style="opacity:0.99;fill-opacity:1; stroke-width:4;stroke-dasharray:none;stroke-opacity:1" d="m 36.961917,29.902848 c 3.596357,-1.826163 63.333473,26.918008 63.449063,32.530093 0.1386,6.729203 -61.229407,35.615675 -63.254766,33.796117 -1.971501,-1.557746 -3.672784,-64.52183 -0.194297,-66.32621 z" id="path1060"> </svg>
|
2022-11-21 13:39:05 -05:00
|
|
|
</div>
|
|
|
|
</button>
|
2022-11-09 15:44:15 -05:00
|
|
|
<input class="media-seek" type="range" onchange="update_video_time(event)" value="0">
|
|
|
|
<select onchange="update_video_speed(event)">
|
|
|
|
<option value="1" selected>1x</option>
|
|
|
|
<option value="1.5">1.5x</option>
|
|
|
|
<option value="2">2x</option>
|
|
|
|
<option value="2.5">2.5x</option>
|
|
|
|
<option value="3">3x</option>
|
|
|
|
</select>
|
|
|
|
<p><span class="audio-currentTime"></span><span class="audio-duration"></span></p>
|
2022-11-21 13:39:05 -05:00
|
|
|
<div class="icon" onclick="fullscreen(event)">
|
2022-11-22 14:04:18 -05:00
|
|
|
<svg viewBox="0 0 120 120">
|
2022-11-21 13:39:05 -05:00
|
|
|
<path
|
|
|
|
style="opacity:0.99;fill-opacity:1;stroke-width:2.58928;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
|
|
|
|
d="M 46.964564,56.005523 29.64354,38.443145 15.744327,51.812481 15.624368,16.779513 l 36.623948,0.03226 -13.177737,14.17536 16.622539,16.392689 z"
|
2022-11-21 13:47:22 -05:00
|
|
|
id="path8948-3"/>
|
2022-11-21 13:39:05 -05:00
|
|
|
<path
|
|
|
|
style="opacity:0.99;fill-opacity:1;stroke-width:2.58928;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
|
|
|
|
d="M 55.129887,73.388205 38.422614,90.210417 51.067135,104.89922 16.395468,104.33333 16.434945,67.605641 30.111493,81.28219 46.504182,64.659651 Z"
|
2022-11-21 13:47:22 -05:00
|
|
|
id="path8948-3-5"/>
|
2022-11-21 13:39:05 -05:00
|
|
|
<path
|
|
|
|
style="opacity:0.99;fill-opacity:1;stroke-width:2.58928;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
|
|
|
|
d="M 63.363444,46.935211 80.997081,30.825588 67.627745,17.036604 102.68744,17.447746 102.62846,52.646518 88.168059,39.041226 71.989147,55.663767 Z"
|
2022-11-21 13:47:22 -05:00
|
|
|
id="path8948-3-6"/>
|
2022-11-21 13:39:05 -05:00
|
|
|
<path
|
|
|
|
style="opacity:0.99;fill-opacity:1;stroke-width:2.58928;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
|
|
|
|
d="M 71.956318,65.743071 91.343851,82.735377 104.06395,70.648701 103.79532,105.13832 69.166628,105.79193 82.579575,93.184265 63.227764,74.368773 Z"
|
2022-11-21 13:47:22 -05:00
|
|
|
id="path8948-3-5-2"/>
|
2022-11-21 13:39:05 -05:00
|
|
|
</svg>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2022-11-09 15:44:15 -05:00
|
|
|
</div>
|
2022-11-21 13:39:05 -05:00
|
|
|
<script>
|
|
|
|
function setup_video_metadata(event) {
|
|
|
|
video = event.target;
|
|
|
|
var seek = video.parentElement.children[1].children[1];
|
|
|
|
seek.min = 0;
|
|
|
|
seek.max = video.duration;
|
|
|
|
seek.value = video.currentTime;
|
|
|
|
details = video.parentElement.children[1].children[3].children;
|
|
|
|
details[0].innerHTML = timeToText(video.currentTime) + "/";
|
|
|
|
details[1].innerHTML = timeToText(video.duration);
|
2022-11-09 15:44:15 -05:00
|
|
|
|
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
function playthis(event) {
|
|
|
|
if (event.target.paused) {
|
|
|
|
event.target.playbackRate = video.parentElement.children[1].children[2].value;
|
|
|
|
event.target.play();
|
2022-11-22 14:04:18 -05:00
|
|
|
video.parentElement.children[1].children[0].innerHTML = icons['pause'];
|
2022-11-21 13:39:05 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
event.target.pause();
|
2022-11-22 14:04:18 -05:00
|
|
|
video.parentElement.children[1].children[0].innerHTML = icons['play'];
|
2022-11-21 13:39:05 -05:00
|
|
|
}
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
function fullscreen(event) {
|
|
|
|
video = event.target.parentElement.parentElement;
|
|
|
|
if (document.fullscreenElement) {
|
|
|
|
document.exitFullscreen();
|
2022-11-22 14:04:18 -05:00
|
|
|
event.target.innerHTML = icons['expand'];
|
2022-11-21 13:39:05 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
video.requestFullscreen();
|
2022-11-22 14:04:18 -05:00
|
|
|
event.target.innerHTML = icons['shrink'];
|
2022-11-21 13:39:05 -05:00
|
|
|
}
|
|
|
|
|
2022-11-09 15:44:15 -05:00
|
|
|
|
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
function toggle_video_play(event) {
|
|
|
|
video = event.target.parentElement.parentElement.children[0];
|
|
|
|
if (video.paused) {
|
|
|
|
video.playbackRate = video.parentElement.children[1].children[2].value;
|
|
|
|
video.play();
|
2022-11-22 14:04:18 -05:00
|
|
|
video.parentElement.children[1].children[0].innerHTML = icons['pause'];
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
else {
|
|
|
|
video.pause();
|
2022-11-22 14:04:18 -05:00
|
|
|
video.parentElement.children[1].children[0].innerHTML = icons['play'];
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
function update_video_speed(event) {
|
|
|
|
video = event.target.parentElement.parentElement.children[0];
|
|
|
|
video.playbackRate = event.target.value;
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
function update_video_time(event) {
|
|
|
|
video = event.target.parentElement.parentElement.children[0];
|
|
|
|
video.currentTime = event.target.value;
|
2022-11-09 15:44:15 -05:00
|
|
|
}
|
2022-11-21 13:39:05 -05:00
|
|
|
|
|
|
|
function timeToText(t) {
|
|
|
|
hours = 0;
|
|
|
|
minutes = 0;
|
|
|
|
seconds = 0;
|
|
|
|
if (t > 60 * 60) {
|
|
|
|
hours = Math.floor(t / 60 / 60);
|
|
|
|
t = t - hours * 60 * 60;
|
|
|
|
}
|
|
|
|
if (t > 60) {
|
|
|
|
minutes = Math.floor(t / 60);
|
|
|
|
t = t - minutes * 60
|
|
|
|
|
|
|
|
}
|
|
|
|
if (t > 1) {
|
|
|
|
seconds = Math.floor(t);
|
|
|
|
}
|
|
|
|
text = "";
|
|
|
|
if (hours > 0) {
|
|
|
|
text += hours + ":";
|
|
|
|
}
|
|
|
|
if (minutes > 0 || hours > 0) {
|
|
|
|
if (minutes == 0) {
|
|
|
|
minutes = "00"
|
|
|
|
}
|
|
|
|
if (minutes < 10) {
|
|
|
|
text += "0"
|
|
|
|
}
|
|
|
|
text += minutes + ":"
|
|
|
|
}
|
|
|
|
if (seconds == 0 && (minutes > 0 || hours > 0)) {
|
|
|
|
seconds = "00";
|
|
|
|
}
|
|
|
|
if (seconds < 10) {
|
|
|
|
text += "0";
|
|
|
|
}
|
|
|
|
text += seconds
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
</script>
|
2022-11-09 15:44:15 -05:00
|
|
|
</div>
|
|
|
|
<noscript>
|
|
|
|
<style>
|
|
|
|
.video-player {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
</style>
|
2022-11-22 14:04:18 -05:00
|
|
|
<video controls preload="false">
|
2022-11-09 15:44:15 -05:00
|
|
|
<source src='{{.Site.BaseURL}}{{.Get "src" }}'>
|
|
|
|
</video>
|
|
|
|
</noscript>
|
|
|
|
|
2022-11-21 13:39:05 -05:00
|
|
|
<p class="caption">{{.Get "caption"}} {{if .Get "source"}}<a href='{{.Get "source"}}'>Source</a>{{end}}
|
2022-11-09 15:44:15 -05:00
|
|
|
</p>
|
|
|
|
</div>
|