Skip to content

Commit 3f71ac8

Browse files
committed
with video.js
1 parent 0a8cb5e commit 3f71ac8

File tree

1 file changed

+39
-12
lines changed

1 file changed

+39
-12
lines changed

index.html

+39-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
1-
<html>
2-
<head>
3-
<script src="https://player.live-video.net/1.1.2/amazon-ivs-player.min.js"></script>
4-
</head>
5-
<body>
6-
<video id="video-player" playsinline></video>
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.6.6/video-js.css" rel="stylesheet">
5+
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.6.6/video.min.js"></script>
6+
<script src="https://player.live-video.net/1.1.2/amazon-ivs-videojs-tech.min.js"></script>
7+
</head>
8+
9+
<body>
10+
<div class="video-container">
11+
<video id="amazon-ivs-videojs" class="video-js vjs-4-3 vjs-big-play-centered" controls autoplay playsinline></video>
12+
</div>
13+
<style>
14+
body {
15+
margin: 0;
16+
}
17+
18+
.video-container {
19+
width: 640px;
20+
height: 480px;
21+
margin: 15px;
22+
}
23+
</style>
724
<script>
8-
if (IVSPlayer.isPlayerSupported) {
9-
const player = IVSPlayer.create();
10-
player.attachHTMLVideoElement(document.getElementById('video-player'));
11-
player.load("https://3b3a35c71f80.us-east-1.playback.live-video.net/api/video/v1/us-east-1.500851630739.channel.qZaQcHvfPYEY.m3u8");
12-
player.play();
13-
}
25+
(function play() {
26+
// Get playback URL from Amazon IVS API
27+
var PLAYBACK_URL = 'https://3b3a35c71f80.us-east-1.playback.live-video.net/api/video/v1/us-east-1.500851630739.channel.qZaQcHvfPYEY.m3u8';
28+
29+
// Register Amazon IVS as playback technology for Video.js
30+
registerIVSTech(videojs);
31+
32+
// Initialize player
33+
var player = videojs('amazon-ivs-videojs', {
34+
techOrder: ["AmazonIVS"]
35+
}, () => {
36+
console.log('Player is ready to use!');
37+
// Play stream
38+
player.src(PLAYBACK_URL);
39+
});
40+
})();
1441
</script>
1542
</body>
1643
</html>

0 commit comments

Comments
 (0)