index.html.j2 1.51 KB
Newer Older
hatsch's avatar
hatsch committed
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
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Clappr/Hls.js with P2P Media Loader</title>
    <meta charset="utf-8">
    <script src="https://cdn.jsdelivr.net/npm/p2p-media-loader-core@latest/build/p2p-media-loader-core.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@latest/build/p2p-media-loader-hlsjs.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/clappr@latest"></script>
</head>
<body>

    <div id="player"></div>
</br></br></br>

<div id="info">      
RTMP Url: {{ site.key }}/{{rtmp.key}}
</br>

###### To be removed</br>
KEY: {{ rtmp.value.key }}</br>
Secret: {{ rtmp.value.secret }}</br>
</div>


    <script>
        if (p2pml.hlsjs.Engine.isSupported()) {
            var engine = new p2pml.hlsjs.Engine();

            var player = new Clappr.Player({
                parentId: "#player",
                source: "http://{{ site.key }}/hls/{{rtmp.key}}/{{ rtmp.value.key }}/index.m3u8",
                actualLiveTime: true,
                mute: true,
                autoPlay: true,
                width: '640',
                height: '360',
                hideMediaControl: true,
                playback: {
                    hlsjsConfig: {
                        liveSyncDurationCount: 7,
                        loader: engine.createLoaderClass()
                    }
                }
            });

            p2pml.hlsjs.initClapprPlayer(player);
        } else {
            document.write("Not supported :(");
        }
    </script>

</body>
</html>