1.3.5 • Published 3 months ago
@gaopeng123/multi-player v1.3.5
multi-player
播放器
media-data-source
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
type | 流媒体类型 | mse: MPEG2-TS/FLV over WebSocketmpegts: MPEG2-TS over HTTP m2ts: flv: HTTPHTTP FLVmp4 | flv |
isLive | 是否为直播流 | boolean | true |
cors | 是否启用 CORS | boolean | true |
withCredentials | 是否使用cookie | boolean | false |
hasAudio | 是否有音轨 | boolean | false |
hasVideo | 是否有视频轨道 | boolean | true |
duration | 总媒体持续时间,以毫秒为单位 | number | |
filesize | 媒体文件的总文件大小,以字节为单位 | number | |
url | 媒体 URL,可以以'http(s)' 或者 'ws(s)' (WebSocket)开头 | string | |
segments | Array |
config
https://github.com/xqq/mpegts.js/blob/master/docs/api.md#config
robustness
type MultiPlayerRobustness = {
bufferTime: DOMTimeStamp; // 播放过程中缓冲器最小矫正的时间 默认为1000ms
loopBufferTime: DOMTimeStamp; // 多场时间探测一次 默认5000ms
maxResetTimes: number; // 最大断线重连次数 默认为 5 次
};
Events
https://github.com/xqq/mpegts.js/blob/master/docs/api.md#mpegtsevents
import {MultiPlayerEvent} from "@gaopeng123/multi-player"
const player = document.querySelector('#player');
player.addEventListener(MultiPlayerEvent.STATISTICS_INFO, ({detail}) => {
console.log(detail);
});
Error
https://github.com/xqq/mpegts.js/blob/master/docs/api.md#mpegtserrortypes
import {MultiPlayerError} from "@gaopeng123/multi-player"
const player = document.querySelector('#player');
player.addEventListener(MultiPlayerError.NETWORK_ERROR, ({detail}) => {
console.log(detail);
});
Usage
<multi-player
id="player"
media-data-source='{"url": "https://xxx/flv/xxx"}'>
</multi-player>
const player = document.querySelector('#player');
player.addEventListener(MultiPlayerError.NETWORK_ERROR, ({detail}) => {
console.log(detail);
});
1.3.5
3 months ago
1.3.4-alpha.9
5 months ago
1.3.2
5 months ago
1.3.0
5 months ago
1.2.7-alpha.19
10 months ago
1.2.7-alpha.18
10 months ago
1.2.7-alpha.17
10 months ago
1.2.7-alpha.16
10 months ago
1.2.5
10 months ago
1.2.7-alpha.15
10 months ago
1.2.7-alpha.14
10 months ago
1.2.7-alpha.13
10 months ago
1.2.7-alpha.12
10 months ago
1.2.7-alpha.11
10 months ago
1.2.7-alpha.10
10 months ago
1.2.12
9 months ago
1.2.13
9 months ago
1.2.10
10 months ago
1.2.11
9 months ago
1.2.16
9 months ago
1.2.15
9 months ago
1.0.2
1 year ago
0.9.4
1 year ago
1.0.2-alpha.9
1 year ago
0.9.6
1 year ago
1.0.2-alpha.10
1 year ago
0.6.12
1 year ago
0.6.11
1 year ago
0.7.5
1 year ago
0.8.1
1 year ago
0.6.3
1 year ago
0.6.2
1 year ago
0.5.3
1 year ago
0.5.0
2 years ago
0.7.0
1 year ago
0.5.2
2 years ago
0.5.1
2 years ago
0.4.8
2 years ago
0.4.6
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.18
2 years ago
0.2.17
2 years ago
0.2.16
2 years ago
0.2.15
2 years ago