-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.html
314 lines (302 loc) · 10.4 KB
/
control.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<html>
<title>VTR</title>
<body style="background-color: #393939">
<left style="background-color: #717171;">
<input id="sp1" onclick="set1()" type="button" value="映像送出" class="g1b"><hr>
<input id="sp2" onclick="set1()" type="button" value="テロップ作成" class="g1b g1-2">
<input id="sp3" onclick="set1()" type="button" value="時刻表示" class="g1b g1-2">
<input id="sp4" onclick="set1()" type="button" value="左右反転" class="g1b g1-2">
</left>
<prv style="background-color: #646464;">
<img width="100%" src="" id="previewimage" style="filter: blur(10px);">
</prv>
<asset style="background-color: #646464;">
<div id="vtrbox">
</div>
</asset>
<next style="background-color: #646464;">
<img id="nextimage">
</next>
<upload style="background-color: #646464;" >
<input type="file" id="fileInput"><video id="videoElement"></video><canvas id="canvasElement"></canvas>
</upload>
<nowoa style="background-color: #646464;" >
<div id="prd"></div>
</nowoa>
</body>
<style>
.prde{
visibility: hidden;
width:0px;
}
.nowonair{
visibility: visible;
width:100%;
}
upload{
position:absolute;
display:block;
top:480px;
left:68vw;
width:30vw;
height:50px;
}
nowoa{
position:absolute;
display:block;
top:270px;
left:68vw;
width:30vw;
height:50px;
}
next{
position:absolute;
display:flex;
top:10px;
left:68vw;
width:30vw;
height:200px;
}
next::before{
display:block;
content:"NEXT";
position:relative;
background:greenyellow;
font-size:smaller;
top:0px;
padding:10px;
}
#nextimage{
height: 100%;
width:85%;
}
#videoElement{
visibility: hidden;
width:0px;
}
#canvasElement{
visibility: hidden;
width:0px;
}
prv{
position:absolute;
display:block;
top:10px;
left:200px;
height:50%;
width:50vw;
}
asset{
overflow-y: scroll;
overflow-x: hidden;
position:absolute;
display:block;
top:55%;
left:200px;
height:40%;
width:50vw;
}
#vtrbox{
display:flex;
flex-wrap: wrap;
width: 100%;
}
asset::before{
display:block;
content:"Assets";
position:relative;
background:#393939;
border:solid 2px rgba(70,70,70,60);
width:100%;
font-size:smaller;
top:0px;
}
upload::before{
display:block;
content:"Upload";
position:relative;
background:#393939;
border:solid 2px rgba(70,70,70,60);
width:99%;
font-size:smaller;
top:0px;
}
.g1b{
margin-top: 20px;
border:none;
display:block;
width:100px;
text-align: center;
height: 65px;
}
.g1-2{
margin-top: 15px;
}
left{
position:absolute;
display:block;
top:0;
left:0;
height:100%;
padding:0px 10px 0px 10px;
}
.vtrimage{
width:100%;
}
.vtrtumb{
margin:10px;
border:silver groove 5px;
display:flexbox;
width:170px;
text-align: center;
background: #646464;
}
</style>
<script>
let connection;//変更予定
var opre = new PresentationRequest('viewer.html');
var g12e = document.getElementsByClassName("g1-2");
vtrt=[];vp1=[];
for (var i = 0; i < g12e.length; i++) {g12e[i].disabled = true;}
function set1(){
if(document.getElementById("sp1").value=="映像送出"){
document.getElementById("sp1").value="送出停止";
document.getElementById("sp1").setAttribute("style","background:red;");
opre.start()
.then(connection => {
for (var i = 0; i < g12e.length; i++) {g12e[i].disabled = false;}
})
.catch(error => {
document.getElementById("sp1").value="映像送出";
document.getElementById("sp1").setAttribute("style","background:#ebecec;");
alert("接続エラー \n 接続を確認し送出先を選択してください \n ・windowsの場合➡表示モードが「拡張」になっているか確認する \n ・iPadやその他Androidの場合➡ケーブルの接続や動作要件を満たす");
//本番時は絶対にtrueにしないと矛盾が発生して正常動作しない
for (var i = 0; i < g12e.length; i++) {g12e[i].disabled = true;}
});
}else{
document.getElementById("sp1").value="映像送出";
document.getElementById("sp1").setAttribute("style","background:#ebecec;");
for (var i = 0; i < g12e.length; i++) {g12e[i].disabled = true;}
opre.close();
}
}
const fileInput = document.getElementById('fileInput');
const videoElement = document.getElementById('videoElement');
const canvasElement = document.getElementById('canvasElement');
const thumbnailElement = document.getElementById('previewimage');
fileInput.addEventListener('change', (event) => {
const file = event.target.files[0];
const videoURL = URL.createObjectURL(file);
videoElement.src = videoURL;
vp1.push(videoURL);
setTimeout(convertVideoToBase64,1000);
});
function convertVideoToBase64() {
const canvasContext = canvasElement.getContext('2d');
canvasContext.drawImage(videoElement, 0, 0, canvasElement.width, canvasElement.height);
const base64VideoData = canvasElement.toDataURL('video/mp4');
setTimeout(generateThumbnail,1000);
}
function generateThumbnail() {
const canvasContext = canvasElement.getContext('2d');
canvasContext.drawImage(videoElement, 0, 0, canvasElement.width, canvasElement.height);
const thumbnailData = canvasElement.toDataURL('image/jpeg');
thumbnailElement.src = thumbnailData;
setTimeout(function(){addVTR(thumbnailData)},1000);
}
var vtrbox = document.getElementById("vtrbox");
var nextimage = document.getElementById("nextimage");
var vtrid = 0;
function addVTR(im1){
vtrid++;
var vtrtumb = document.createElement('div');
vtrtumb.className="vtrtumb";
var timage = document.createElement('img');
timage.className="vtrimage";
timage.setAttribute("src",im1);
vtrtumb.innerHTML="<p>VTR-"+vtrid+"</p>";
vtrtumb.appendChild(timage);
vtrbox.appendChild(vtrtumb);
vtrt.push(im1);
}
var keyexc=["q","w","e","r","t","y","u","i","o"];
document.addEventListener('keydown', keydownEvent,false);
function keydownEvent(event){
if(keyexc.indexOf(event.key) != -1){
nextimage.src=vtrt[parseInt(keyexc.indexOf(event.key))];
// opre.sender.postMessage({
//type: 'callFunction',
//functionName: 'prd',
// });
prd(vp1[parseInt(keyexc.indexOf(event.key))]);
//opre.send('{"npath": vp[parseInt(keyexc.indexOf(event.key) - 1)]}');
}else if(event.key == "l"){
change();
// thumbnailElement.src=nextimage.src;
// opre.sender.postMessage({
// type: 'callFunction',
//functionName: 'change'});
}else{
return false;
}
}
var preloadwmovie = document.getElementById("prd");
var loaderid = 0;
function prd(ur1){
if(loaderid==2){
var oac = document.createElement('video');
oac.src = ur1;
oac.id = 'preloader'+loaderid;
oac.className="prde";
oac.setAttribute("preload","true");
preloadwmovie.appendChild(oac);
oac.addEventListener('ended', function() {endach1();}, false);
loaderid = loaderid - 1;
}else if(loaderid==1){
loaderid++;
var oac = document.createElement('video');
oac.src = ur1;
oac.id = 'preloader'+loaderid;
oac.className="prde";
oac.setAttribute("preload","true");
preloadwmovie.appendChild(oac);
oac.addEventListener('ended', function() {endach2();}, false);
}else{
loaderid++;
var oac = document.createElement('video');
oac.src = ur1;
oac.id = 'preloader'+loaderid;
oac.className="prde";
preloadwmovie.appendChild(oac);
oac.addEventListener('ended', function() {endach1();}, false);
}
}
var aida=0;
function change() {
aida++;
if(aida=>2){
if(loaderid==2){
document.getElementById("preloader1").className="nowonair";
document.getElementById("preloader1").play();
document.getElementById("preloader2").remove();
}else if(loaderid==1){
document.getElementById("preloader2").className="nowonair";
document.getElementById("preloader2").play();
document.getElementById("preloader1").remove();
}
}else{
var aida = 2;
document.getElementById("preloader1").className="nowonair";
document.getElementById("preloader1").play();
}
}
function endach1(){
document.getElementById("preloader1").remove();
change();
}
function endach2(){
document.getElementById("preloader2").remove();
change();
}
</script>
</html>