Giter Club home page Giter Club logo

p2pplayer's Introduction

还没有开发好

CBPlayer

CBPlayer

🍭 Wow, such a lovely HTML5 danmaku video player

npm npm npm

Introduction

CBPlayer 是基于 DPlayer 开发的,内置 CDNBye P2P 插件的 H5 播放器,加入了记忆播放等实用功能,右键可以查看p2p实时数据。


CBPlayer的API与DPlayer保持一致,可以参考DPLayer的官方文档:

Docs

中文文档

集成方法

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cbplayer@latest/dist/CBPlayer.min.css" />
<div id="cbplayer"></div>
<script src="https://cdn.jsdelivr.net/npm/cbplayer@latest"></script>
<script>
    new CBPlayer({
        container: document.getElementById('cbplayer'),
        autoplay: true,
        video: {
            url: 'http://cn1.kankia.com/hls/20191220/596ff11e1db2c3969da01367fc41d3b0/1576776716/index.m3u8',
        },
        pluginOptions: {
            hls: {
                p2pConfig: {
                    live: false,
                    // Other p2pConfig options provided by CDNBye
                    // https://docs.cdnbye.com/#/API
                }
            }
        },
    });
</script>

完整php版调用代码

调用方式:http://example.com?url=

<html>
<head>
    <title>dplayer增加记忆+P2P播放</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=11" />
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cbplayer@latest/dist/CBPlayer.min.css" />
    <style type="text/css">
        body,html{width:100%;height:100%;background:#000;padding:0;margin:0;overflow-x:hidden;overflow-y:hidden}
        *{margin:0;border:0;padding:0;text-decoration:none}
        #video{position:inherit}
    </style>
</head>
<body style="background:#000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu=window.event.returnValue=false>
<div id="video"></div>
<script src="https://cdn.jsdelivr.net/npm/cbplayer@latest"></script>
<script>
    var url = '<?php echo($_REQUEST['url']);?>';
    var dp = new CBPlayer({
        container: document.getElementById('video'),
        autoplay: true,
        hotkey: true,  // 移动端全屏时向右划动快进,向左划动快退。
        video: {
            url:url,
            // pic: 'loading_wap.gif',
        },
    });
    dp.on('fullscreen', function () {
        if (/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
            screen.orientation.lock('landscape');
        }
    });
</script>
</body>
</html>

p2pplayer's People

Contributors

diygod avatar dependabot-preview[bot] avatar a-circle-zhang avatar micooz avatar kn007 avatar lighthouseapps avatar dependabot[bot] avatar snowinszu avatar oukanina avatar egoist avatar zhw2590582 avatar lqzhgood avatar copay avatar sdvcrx avatar nddnvjfd avatar sinchang avatar stumble avatar xqin avatar a-wing avatar pvnr0082t avatar dnshi avatar jericopulvera avatar jakelaoyu avatar reuwi avatar b11p avatar xincmm avatar jaycjp avatar david082321 avatar deepred5 avatar eyhn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.