Metrics
0
Watch 175 Star 487 Fork 126

GVPPear / PearPlayer.jsJavaScript

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
PearPlayer.js 一个支持多协议,多源、混合P2P-CDN的流媒体播放器 spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README_EN.md


PearPlayer.js

A multi-protocol, multi-source and hybrid P2P-CDN streaming media player

. npm jsdelivr License


English

PearPlayer (梨享播放器) [Demo] is a streaming media player framework written completely with HTML5 and JavaScript. Combining HTTP (including HTTPS, HTTP2) and WebRTC, PearPlayer accelerates media streaming on the Web. It supports multiple protocols, multiple sources, and achieves low latency and high bandwidth utilization. With the help of H5 MSE (Media Source Extension) technology, it receives buffers from multiple source nodes and delivers to the player. Finely designed algorithms are adopted to achieve the best scheduling effect and to handle abnormal situations. Thus, PearPlayer can provide end-users with wonderful video watching experience while maximizing the P2P ratio at the same time.

PearPlayer

multisources

Simply import pear-player.min.js to HTML via the <script> tag. Refer to code examples below, or consult /examples/player-test.html or get-started for usages.

Features

  • Plugin-free thanks to the P2P ability based on WebRTC
  • Multi-protocol (HTTP, HTTPS, WebRTC) and multi-source
  • Customized algorithms that provide users with wonderful video watching experience while maximizing the P2P ratio at the same time.
  • Parameter-free by default (dynamic adaptive internally according to bitrate, etc.). Clients can fill in their preferred parameters in advanced mode.
  • Buffers are limited to save bandwidth/traffic for CP users.
  • Support Chrome, Firefox, Opera, IE, Edge and other mainstream browsers; will support Safari, Tencent WeChat and X5/TBS (multi-source transmission is enabled; media playback issues will be well resolved when MSE is supported)
  • Optional access to low cost, high availability Pear Fog CDN
  • Fully encrypted via TLS/DTLS by default, no DPI features; statistical characteristics can be further eliminated using dynamic port mapping of Pear Fog Suite.
  • As easy as using HTML5 <video> tag; easy to integrate with popular player frameworks like video.js
  • With Browser-to-Browser P2P ability (based on WebTorrent)

bitmap

Quick Start

Please copy the following codes into Web HTML5 code, and then open the webpage. Now, it's time to witness the miracle.

<video id="video" controls></video>
<script>
  var player = new PearPlayer('#video', { src: 'https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4' });
</script>

Usages

Import js file and bind to video tag

First import the <script> tag to pear-player.min.js:

<script src="./dist/pear-player.min.js"></script>

or use CDN:

<script src="https://cdn.jsdelivr.net/npm/pearplayer@latest"></script>

If use video tag to play the following video, HTML is like below:

<video id="pearvideo" src="https://qq.webrtc.win/tv/Pear-Demo-Yosemite_National_Park.mp4" controls>

PearPlayer can be bound to the video tag using only the codes below:

<script>
  /**
  * The first parameter is ID or CLASS of the video tag
  * Opts means the optional parameter configurations
  */
  if (PearPlayer.isMSESupported()) {
    var player = new PearPlayer('#pearvideo', opts);
  }
</script>

Congratulations! NOW your player has P2P ability and no plug-ins!

How to accelerate your videos?

The video above has already been dispatched. So how to speed up other videos? Just add your video URL into Pear Fog Content Delivery Operating System. And then you can feel free to use Pear's massive fog nodes to accelerate your videos! Please click here for detailed guide. (Currently, newly-registered users can distribute three MP4/TS files, each under 100MB, free of charge. Prefix Pear-Demo- prefix needs to be added in front of the video file name, such as Pear-Demo-movie.mp4)

Who's using PearPlayer today?

PearPlayer Documents

Acknowledgement

Special thanks goes to the following projects that provide some inspirations and API design references:

Speech and Media Reports

License

MIT. Copyright (c) Pear Limited and snowinszu.

Help and Support

E-mail: service@pear.hk; User QQ group:373594967; CP/CDN, OEM and other business cooperations

Comments ( 12 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025