1.2.4 • Published 3 years ago

xgplayer-encrypt-mp4 v1.2.4

Weekly downloads
6
License
MIT
Repository
-
Last release
3 years ago

加密MP4播放插件

安装

npm i xgplayer
npm i xgplayer-encrypt-mp4

使用方式

通过 kid 播放

import 'xgplayer'
import Mp4Player from 'xgplayer-encrypt-mp4'

let player = new Mp4Player({
  id: 'vs',
  url: 'xxx',
  vid: 'xxx',
  kid: 'xxx'
});

通过 keyValue 播放

import 'xgplayer'
import Mp4Player from 'xgplayer-encrypt-mp4'

let player = new Mp4Player({
  id: 'vs',
  url: 'xxx',
  vid: 'xxx',
  keyValue: 'xxx'
});

使用经过加密的 secretKey 播放

import 'xgplayer'
import Mp4Player from 'xgplayer-encrypt-mp4'

let player = new Mp4Player({
  id: 'vs',
  url: 'xxx',
  secretKey: 'xxx',
  withCredentials: true //支持请求携带cookie
});

通过传 drm 的方式播放

import 'xgplayer'
import Mp4Player from 'xgplayer-encrypt-mp4'

let player = new Mp4Player({
  id: 'vs',
  url: 'xxx',
  vid: 'xxx',
  drm: {
    clearKeys: {
      'xxx': 'xxx'
    }
  }
});

其它播放器配置参数和API使用请参考 http://h5player.bytedance.com/config/

兼容性

判断是否支持播放

Mp4Player.isSupported()

Android 4.4 以上 IOS 13 以上

1.2.4

3 years ago

1.2.3

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago