larkplayer-hls

0.1.3 • Public • Published

larkplayer-hls

larkplayer 插件,用于播放 m3u8 视频

基于 hls.js 开发

下载

NPM

npm install larkplayer-hls

CDN

<script type="text/javascript" src="https://unpkg.com/larkplayer-hls@latest/dist/larkplayer-hls.js"></script>

使用

script

<!DOCTYPE html>
<html>
<head>
    <title>larkplayer hls</title>
</head>
<body>
    <video id="video-el" src="https://video-dev.github.io/streams/x36xhzz/x36xhzz.m3u8" loop controls></video>
 
    <script type="text/javascript" src="https://unpkg.com/larkplayer@latest/dist/larkplayer.js"></script>
    <script type="text/javascript" src="https://unpkg.com/larkplayer-hls@latest/dist/larkplayer-hls.js"></script>
 
    <script type="text/javascript">
        var player = larkplayer('video-el', {
            width: 640,
            height: 360,
            MS: {
                // 可选,详细参数见 https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning
                hls: {}
            }
        }, function () {
            console.log('player is ready');
        });
 
        player.play();
    </script>
</body>
</html>
 

npm & es6

import larkplayer from 'larkplayer';
import 'larkplayer-hls';
 
const player = larkplayer('video-el');
 
player.src('xxx.m3u8');
player.play();
 

Package Sidebar

Install

npm i larkplayer-hls

Weekly Downloads

24

Version

0.1.3

License

MIT

Unpacked Size

1.55 MB

Total Files

7

Last publish

Collaborators

  • 2222bnting
  • huangyan09