mirror of
https://github.com/bytedance/xgplayer.git
synced 2025-04-05 03:05:02 +08:00
Compare commits
4 Commits
281175f542
...
4c25a80d83
Author | SHA1 | Date | |
---|---|---|---|
|
4c25a80d83 | ||
|
d9545b0c11 | ||
|
e61e9c7a38 | ||
|
a87316cb44 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-ads",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
@ -24,10 +24,10 @@
|
||||
"dependencies": {
|
||||
"can-autoplay": "^3.0.2",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.1"
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"core-js": ">=3.12.1",
|
||||
"xgplayer": "3.0.22-rc.1"
|
||||
"xgplayer": "3.0.22-rc.4"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-dash-live",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-dash",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "xgplayer plugin for MPEG-DASH",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
@ -38,7 +38,7 @@
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xgplayer": "3.0.22-rc.1",
|
||||
"xgplayer": "3.0.22-rc.4",
|
||||
"core-js": ">=3.12.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-flv.js",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "web video player",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
@ -37,6 +37,6 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"core-js": ">=3.12.1",
|
||||
"xgplayer": "3.0.22-rc.1"
|
||||
"xgplayer": "3.0.22-rc.4"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-flv",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
@ -23,8 +23,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"eventemitter3": "^4.0.7",
|
||||
"xgplayer-transmuxer": "3.0.22-rc.1",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.1"
|
||||
"xgplayer-transmuxer": "3.0.22-rc.4",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xgplayer": ">=3.0.1",
|
||||
|
@ -163,11 +163,11 @@ export class Flv extends EventEmitter {
|
||||
* @param {string} [url]
|
||||
* @return {Promise}
|
||||
*/
|
||||
async load (url, reuseMse = false) {
|
||||
async load (url, reuseMse = false, streamRes) {
|
||||
if (!this._bufferService) return
|
||||
await this._reset(reuseMse)
|
||||
|
||||
this._loadData(url, this._opts.isLive ? [] : [0, this._opts.defaultVodLoadSize])
|
||||
this._loadData(url, this._opts.isLive ? [] : [0, this._opts.defaultVodLoadSize], streamRes)
|
||||
|
||||
clearTimeout(this._tickTimer)
|
||||
this._tickTimer = setTimeout(this._tick, this._tickInterval)
|
||||
@ -298,7 +298,7 @@ export class Flv extends EventEmitter {
|
||||
await this._bufferService.reset(reuseMse)
|
||||
}
|
||||
|
||||
async _loadData (url, range) {
|
||||
async _loadData (url, range, streamRes) {
|
||||
if (url) this._opts.url = url
|
||||
let finnalUrl = (url = this._opts.url)
|
||||
if (!url) throw new Error('Source url is missing')
|
||||
@ -322,7 +322,7 @@ export class Flv extends EventEmitter {
|
||||
|
||||
this._loading = true
|
||||
try {
|
||||
await this._mediaLoader.load({ url: finnalUrl, range })
|
||||
await this._mediaLoader.load({ url: finnalUrl, range, streamRes })
|
||||
} catch (error) {
|
||||
this._loading = false
|
||||
return this._emitError(StreamingError.network(error), false)
|
||||
|
@ -114,7 +114,9 @@ export class FlvPlugin extends BasePlugin {
|
||||
this._transCoreEvent(EVENT.SWITCH_URL_SUCCESS)
|
||||
this._transCoreEvent(EVENT.SWITCH_URL_FAILED)
|
||||
|
||||
this.flv.load(config.url, true)
|
||||
if (!flvOpts.manualLoad) {
|
||||
this.loadSource(config.url, flvOpts.streamRes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,6 +126,10 @@ export class FlvPlugin extends BasePlugin {
|
||||
return this.flv?.getStats()
|
||||
}
|
||||
|
||||
loadSource = (url = this.player.config.url, streamRes) => {
|
||||
this.flv?.load(this.player.config.url, true, streamRes)
|
||||
}
|
||||
|
||||
destroy = () => {
|
||||
if (this.flv) {
|
||||
this.flv.destroy()
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-hls.js",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "xgplayer plugin for hls",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-hls",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
@ -23,11 +23,11 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"eventemitter3": "^4.0.7",
|
||||
"xgplayer-transmuxer": "3.0.22-rc.1",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.1"
|
||||
"xgplayer-transmuxer": "3.0.22-rc.4",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xgplayer": "3.0.22-rc.1",
|
||||
"xgplayer": "3.0.22-rc.4",
|
||||
"core-js": ">=3.12.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-mp4-loader",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
@ -22,8 +22,8 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"xgplayer-transmuxer": "3.0.22-rc.1",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.1",
|
||||
"xgplayer-transmuxer": "3.0.22-rc.4",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.4",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-mp4",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "xgplayer plugin for mp4 transform to fmp4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
@ -39,9 +39,9 @@
|
||||
"concat-typed-array": "^1.0.2",
|
||||
"deepmerge": "^2.0.1",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"xgplayer-mp4-loader": "3.0.22-rc.1",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.1",
|
||||
"xgplayer-transmuxer": "3.0.22-rc.1"
|
||||
"xgplayer-mp4-loader": "3.0.22-rc.4",
|
||||
"xgplayer-streaming-shared": "3.0.22-rc.4",
|
||||
"xgplayer-transmuxer": "3.0.22-rc.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xgplayer": ">=3.0.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-music",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "xgplayer plugin for music",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
@ -43,7 +43,7 @@
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"xgplayer": "3.0.22-rc.1",
|
||||
"xgplayer": "3.0.22-rc.4",
|
||||
"core-js": ">=3.12.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-shaka",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "xgplayer plugin for shaka-player",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-streaming-shared",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
|
@ -49,7 +49,8 @@ export class FetchLoader extends EventEmitter {
|
||||
referrer,
|
||||
referrerPolicy,
|
||||
onProcessMinLen,
|
||||
priOptions
|
||||
priOptions,
|
||||
streamRes
|
||||
}) {
|
||||
this._logger = logger
|
||||
this._aborted = false
|
||||
@ -108,7 +109,14 @@ export class FetchLoader extends EventEmitter {
|
||||
const startTime = Date.now()
|
||||
this._logger.debug('[fetch load start], index,', index, ',range,', range)
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch(request || url, request ? undefined : init).then(async (response) => {
|
||||
const promise = streamRes
|
||||
? new Promise(r => {
|
||||
// const response = new Response(stream)
|
||||
// Object.defineProperty(response, 'url', { value: url })
|
||||
r(streamRes)
|
||||
})
|
||||
: fetch(request || url, request ? undefined : init)
|
||||
promise.then(async (response) => {
|
||||
clearTimeout(this._timeoutTimer)
|
||||
this._response = response
|
||||
if (this._aborted || !this._running) return
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-subtitles",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer-transmuxer",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
"typings": "es/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xgplayer",
|
||||
"version": "3.0.22-rc.1",
|
||||
"version": "3.0.22-rc.4",
|
||||
"description": "video player",
|
||||
"main": "dist/index.min.js",
|
||||
"module": "es/index.js",
|
||||
@ -43,7 +43,7 @@
|
||||
"delegate": "^3.2.0",
|
||||
"downloadjs": "1.4.7",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"xgplayer-subtitles": "3.0.22-rc.1"
|
||||
"xgplayer-subtitles": "3.0.22-rc.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"core-js": ">=3.12.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user