-
Notifications
You must be signed in to change notification settings - Fork 0
/
vidtest.html
63 lines (55 loc) · 2.43 KB
/
vidtest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<!-- Include Plyr.js CSS -->
<link rel="stylesheet" href="https://cdn.plyr.io/3.6.3/plyr.css">
</head>
<body>
<div id="video-container" class="video-js">
<video id="my-video" class="video-player" controls
data-poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg">
<h3 class="video-name-header">Lorem ipsum dolor sit amet consectetur adipisicing elit. Libero.</h3>
<source src="/assets/videos/yt5s.com-Lesson 1_ Create a Social Networking Website - Introduction.mp4" type="video/mp4">
<!-- #Caption files -->
<track
kind="captions"
label="English"
srclang="en"
src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt"
default
/>
<track
kind="captions"
label="Français"
srclang="fr"
src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.fr.vtt"
/>
<!-- !Caption files -->
</video>
</div>
<button id="playButtonId">Play</button>
<script src="https://cdn.plyr.io/3.6.3/plyr.js"></script>
<script>
const video = document.getElementById("yourVideoElementId");
const playButton = document.getElementById("playButtonId");
// Initialize Plyr.js
const player = new Plyr(video);
const deUrl = 'https://gredirect.info/download.php?url=aHR0cHM6LyURASDGHUSRFSJGYfdsffsderFStewthsfSFtrfteAdrefsdsdfwerFrefdsfrersfdsrfer36343534sdf9rdGk4bzh4ODV3LmU2Mjc4ZC5jb20vdXNlcjEzNDIvOGQ1YTRiYjRkZmQ4MzU3ZjI2MjRhM2FkMjEwMzViODUvRVAuNy52MC4xNjkyMDM4NDIyLjQ4MHAubXA0P3Rva2VuPTFIQ1RrakwtOVZ1RlhIQkZ4WGROdUEmZXhwaXJlcz0xNjk3MTYzNTQ3JmlkPTIxMDA0Mg==';
const proxyUrl = 'https://cors-anywhere.herokuapp.com/';
// Preload the first 20 seconds
fetch( proxyUrl + deUrl, { headers: { Range: "bytes=0-4194304" } })
.then(response => response.blob())
.then(data => {
const objectURL = URL.createObjectURL(data);
video.src = objectURL;
// When the video is loaded, update Plyr.js and play on button click
video.addEventListener("canplay", function() {
playButton.addEventListener("click", function() {
player.play();
});
});
});
</script>
</body>
</html>
<!-- ----------------------------- -->