免费p2p加速播放器m3u8播放器开源免费

<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">

    <title>DPlayer with hls.js engine and P2P demo</title>

    <script src="../node_modules/p2p-media-loader-core/build/p2p-media-loader-core.js"></script>
    <script src="../build/p2p-media-loader-hlsjs.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/p2p-dplayer@latest/dist/DPlayer.min.css">
    <script src="https://cdn.jsdelivr.net/npm/dplayer@latest"></script>

    <style>
        #dplayer {
            width: 720px;
            margin-left: auto;
            margin-right: auto;
            display: block;
        }
    </style>

</head>
<body>

    <div id="dplayer"></div>

    <script>
        if (Hls.isSupported() && p2pml.hlsjs.Engine.isSupported()) {
            window.dp = new DPlayer({
                container: document.getElementById("dplayer"),
                video: {
                    url: "https://akamai-axtest.akamaized.net/routes/lapd-v1-acceptance/www_c4/Manifest.m3u8",
                    type: "customHls",
                    customType: {
                        "customHls": function (video, player) {
                            const engine = new p2pml.hlsjs.Engine();
                            const hls = new Hls({
                                liveSyncDurationCount: 7, // To have at least 7 segments in queue
                                loader: engine.createLoaderClass()
                            });
                            p2pml.hlsjs.initHlsJsPlayer(hls);
                            hls.loadSource(video.src);
                            hls.attachMedia(video);
                        }
                    }
                }
            });
        } else {
            document.write("Not supported :(");
        }
    </script>

</body>
</html>
Strjson博客交流群QQ群:892570651
Vultr注册就送$50,可开日本/新加坡等机房,【点击注册
Last modification:November 22nd, 2019 at 07:19 pm
If you think my article is useful to you, please feel free to appreciate

2 comments

  1. www

  2. 滚滚滚

    该喝喝

Leave a Comment