17 Star 186 Fork 28

Bytedance Inc. / xgplayer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

概述

西瓜播放器是一个Web视频播放器类库,它本着一切都是组件化的原则设计了独立可拆卸的 UI 组件。更重要的是它不只是在 UI 层有灵活的表现,在功能上也做了大胆的尝试:摆脱视频加载、缓冲、格式支持对 video 的依赖。尤其是在 mp4 点播上做了较大的努力,让本不支持流式播放的 mp4 能做到分段加载,这就意味着可以做到清晰度无缝切换、加载控制、节省视频流量。同时,它也集成了对 flv、hls、dash 的点播和直播支持。文档

起步

  1. 安装

    $ npm install xgplayer
  2. 使用

  • Step 1:

    <div id="vs"></div>
  • Step 2:

    import Player from 'xgplayer'
    
    let player = new Player({
        id: 'vs',
        url: 'http://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4'
    })

    这是最简单的播放器配置方法,基本功能可以跑起来,如果想使用高级功能参考插件一节或者文档。更多配置

插件

西瓜播放器提供了较多的插件,并支持自定义插件,更多内容查看 插件。播放器内有不少内置插件,如果需要关闭某些插件可以通过 ignores 配置禁用

开发调试

为了方便开发者调试,我们在仓库 fixtures 目录内提供了示例代码。播放器使用 yarn 进行包管理,只需简单几步即可开始在仓库内启动调试

$ cd xgplayer
$ yarn
$ yarn dev:xgplayer

其它插件启动,请参考仓库根目录内 package.json 提供 scripts 命令,比如:

$ yarn dev:hls
$ yarn dev:flv
$ yarn dev:mp4

使用协议

欢迎使用西瓜播放器技术团队提供的开源音视频解决方案!请您仔细阅读以下条款。通过使用西瓜播放器,您表示同意接受以下所有条款。

  1. 本开源项目中所有代码基于 MIT 许可协议,您默认遵守许可协议中约定的义务。
  2. 您默认授权我们将您使用西瓜播放器所在业务的Logo放置在本官网展示。 若您有任何问题,请联系我们。
MIT License Copyright (c) 2018 Bytedance Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A HTML5 video player with a parser that saves traffic 展开 收起
JavaScript 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/ByteDance/xgplayer.git
git@gitee.com:ByteDance/xgplayer.git
ByteDance
xgplayer
xgplayer
main

搜索帮助