-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
199 lines (191 loc) · 9.26 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta charset="UTF-8">
<meta name="author" content="CherrieFurry">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>customs video player </title>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css' integrity='sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2' crossorigin='anonymous'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body data-new-gr-c-s-check-loaded="14.1029.0" data-gr-ext-installed="">
<div class="container mt-5">
<div class="card">
<div class="card-content">
<div class="card-header">
<div class="row">
<div class="col-3">
<button class="btn btn-danger btn-sm upload_btn"> <i class="fa fa-upload"></i>
Device</button>
</div>
<div class="col-9 text-right">
<form>
<div class="input-group">
<input name="video_link" required type="text" class="form-control" placeholder="Youtube video link">
<div class="input-group-append">
<button type="submit" class="input-group-text go_btn">Go</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="card-body p-0">
<video class="card-img-top" id="video" autoplay poster="https://www.bitsolution.site/files/poster.png">
<source src="https://www.bitsolution.site/files/video.mp4" id="vid_src">
</source>
</video>
</div>
<div class="card-footer text-center">
<div class="row">
<div class="col-12">
<marquee class="title"></marquee>
</div>
</div>
<div class="row">
<div class="col-6 text-left">
<small id="current">0:00</small>
</div>
<div class="col-6 text-right">
<small id="duration">0:00</small>
</div>
</div>
<div class="row">
<div class="progress w-100 mx-4 m-1" id="progress">
<div class="progress-bar bg-primary" id="progress_bar"></div>
</div>
</div>
<div class="row">
<div class="col">
<i class="fa fa-backward" id="backward"></i>
</div>
<div class="col">
<i class="fa fa-play" id="play_icon"></i>
</div>
<div class="col">
<i class="fa fa-forward" id="forword"></i>
</div>
</div>
<center>
<button class="btn btn-primary m-3 download_btn">
Download Video
</button>
</center>
</div>
</div>
</div>
</div>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script src='https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js' integrity='sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN' crossorigin='anonymous'></script>
<script src='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js' integrity='sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s' crossorigin='anonymous'></script>
<script>
$(document).ready(function() {
function video_controls() {
var video = document.getElementById("video");
// video.style.opacity = "0";
var play_icon = document.querySelector("#play_icon");
play_icon.onclick = function() {
if (this.className == "fa fa-play") {
video.play();
} else if (this.className == "fa fa-pause") {
video.pause();
}
}
video.onplaying = function() {
play_icon.className = "fa fa-pause";
}
video.onpause = function() {
play_icon.className = "fa fa-play";
}
video.ontimeupdate = function() {
var duration = video.duration;
var current = video.currentTime;
document.querySelector("#current").innerHTML = (current / 60).toFixed(2);
document.querySelector("#duration").innerHTML = (duration / 60).toFixed(2);
document.querySelector("#progress_bar").style.width = current * 100 / duration + "%";
document.querySelector("#progress").onclick = function(event) {
var total = this.offsetWidth;
var current_position = event.offsetX;
var forward = current_position / total;
video.currentTime = forward * video.duration;
}
document.querySelector("#backward").onclick = function() {
video.currentTime = video.currentTime - 10;
}
document.querySelector("#forword").onclick = function() {
video.currentTime = video.currentTime + 10;
}
}
};
video_controls();
function upload_video_from_device() {
$(".upload_btn").click(function() {
var video = document.getElementById("video");
var video_src = document.getElementById("vid_src");
var input = document.createElement("input");
input.type = "file";
input.accept = "video/*";
input.click();
input.onchange = function(e) {
var file = this.files[0];
var name = file.name;
$(".title").html(name);
var blob = URL.createObjectURL(file);
video_src.src = blob;
video.load();
video.play();
};
});
};
upload_video_from_device();
function yt_video_fetch() {
$("form").submit(function(event) {
event.preventDefault();
var video = document.getElementById("video");
var video_src = document.getElementById("vid_src");
$.ajax({
type: "POST",
crossDomain: true,
url: "https://yt-vid-fetch.herokuapp.com/info/index.php",
data: new FormData(this),
processData: false,
contentType: false,
cache: false,
async:true,
beforeSend: function() {
$(".go_btn").html("please wait..");
$(".go_btn").prop("disabled", true);
},
success: function(result) {
$(".go_btn").html("Go");
$(".go_btn").prop("disabled", true);
var data = JSON.parse(result);
let title = data.title;
let video_data = data.video;
let thumbnail = data.thumbnail;
video_src.src = video_data;
$(".title").html(title);
video.load();
video.play();
}
})
});
};
yt_video_fetch();
function download() {
$(".download_btn").click(function() {
var video_src = document.getElementById("vid_src");
var src_link = video_src.getAttribute("src");
var a_tag = document.createElement("a");
var vid_title = $(".title").html();
a_tag.href = src_link;
a_tag.download = vid_title;
a_tag.click();
});
};
download();
});
</script>
</body>
</html>