-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
77 lines (74 loc) · 2.68 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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>JPK2024 Operator</title>
<style type="text/css">
body{
background-color: #1A1A1A;
color: #FFFFFF;
}
.wrapper{
width: 500px;
}
</style>
</head>
<body>
<div>
<input type="text" name="id">
<input type="button" name="send" value="表示">
</div>
<iframe id="share" width="1233" height="400" src=""></iframe>
<div class="wrapper">
<div id="title_en"></div>
<div id="title_jp"></div>
<hr>
<div id="speaker"></div>
<hr>
<div id="viewers_count"></div>
<div id="detail"></div>
</div>
<video id="video-player" style="display: none;"></video>
<script src="https://player.live-video.net/1.5.0/amazon-ivs-player.min.js"></script>
<script>
const speakerIdInput = document.querySelector('input[name="id"]');
const sendButton = document.querySelector('input[name="send"]');
sendButton.addEventListener('click', () => {
console.log('click');
getData();
});
async function getData() {
const id = speakerIdInput.value;
const url = `https://script.google.com/macros/s/AKfycbw3lQF7F-v0q73zDxA4g92mqz-C1kFUAGly92JjN3MIgwgWPYlc5me0FFTdxE_pDwHRoQ/exec?id=${id}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}
const json = await response.json();
document.getElementById('title_en').textContent = json.session_title_en;
document.getElementById('title_jp').textContent = json.session_title_jp;
document.getElementById('speaker').textContent = json.speaker;
document.getElementById('detail').textContent = json.detail;
document.getElementById('share').src = json.share_url;
} catch (error) {
console.error(error.message);
}
}
</script>
<script>
if (IVSPlayer.isPlayerSupported) {
const player = IVSPlayer.create();
player.attachHTMLVideoElement(document.getElementById('video-player'));
player.load("https://a632681f2509.ap-northeast-1.playback.live-video.net/api/video/v1/ap-northeast-1.590183817826.channel.ccODHkKBpvgI.m3u8");
player.play();
player.add
player.addEventListener(IVSPlayer.PlayerEventType.TEXT_METADATA_CUE,
function (cue) {
document.getElementById('viewers_count').innerHTML = 'Viewers: ' + cue.text.split(',')[0];
}
);
}
</script>
</body>
</html>