Skip to content

Latest commit

 

History

History
108 lines (79 loc) · 2.72 KB

readme-en.md

File metadata and controls

108 lines (79 loc) · 2.72 KB

larkplayer

 NPM version Downloads License

English | 中文

Overview

larkplayer is a light and flexible web player

  • Lightweight, uglify + gzip < 12kb
  • Solve most compatibility issues, such as full screen, mobile inline playback, etc
  • Provide an event mechanism to proxy native events and allow custom events
  • Provide plugin mechanism to support multiple plugin types
  • Pure javascript, no specific framework dependencies

We separate many functions into plugins, also you can build your own plugin

Check out live examples

Download

NPM

npm install larkplayer

CDN

<script src="https://unpkg.com/larkplayer@latest/dist/larkplayer.js"></script>

Quick Start

Via script

<!DOCTYPE html>
<html>
<head>
    <title>larkplayer quick start</title>
</head>
<body>
    <video id="my-video" src="https://baikebcs.bdimg.com/baike-other/big-buck-bunny.mp4" width="400" height="300" controls>
       Please upgrade or replace your browser to support html5 video 
    </video>
 
    <script type="text/javascript" src="https://unpkg.com/larkplayer@latest/dist/larkplayer.js"></script>
    <script type="text/javascript">
        var player = larkplayer('my-video', {
            width: 640,
            height: 360
        }, function () {
            console.log('player is ready');
        });

        player.on('firstplay', function () {
            console.log('firstplay');
        });

        // support all the standard events
        player.on('play', function () {
            console.log('play');
        });
        player.on('ended', function () {
            console.log('ended');
            player.src('http://www.w3school.com.cn/i/movie.ogg');
            player.play();
        });
    </script>
</body>
</html>

Via npm & es6

import larkplayer from 'larkplayer';

const player = larkplayer('video-el');

Document

API

Change Log

CHANGELOG

License

larkplayer is MIT licensed