bonc-htmlplayer
Advanced tools
Comparing version 5.0.9 to 5.0.10
{ | ||
"name": "bonc-htmlplayer", | ||
"version": "5.0.9", | ||
"version": "5.0.10", | ||
"description": "东方国信的html播放器内核", | ||
@@ -5,0 +5,0 @@ "main": "./dist/BoncH5Player.js", |
@@ -20,3 +20,3 @@ import { extractNALubonc } from "./utils"; | ||
fps: 25, | ||
debug: true, | ||
debug: true | ||
}; | ||
@@ -328,3 +328,3 @@ this.options = defaults; | ||
video: [], | ||
audio: [], | ||
audio: [] | ||
}; | ||
@@ -395,3 +395,3 @@ | ||
video: [], | ||
audio: [], | ||
audio: [] | ||
}; | ||
@@ -432,3 +432,3 @@ | ||
// this.app.node.pause(); | ||
} else if (bufferLength > 0 && bufferLength <= 3) { | ||
} else if (bufferLength > 0 && bufferLength <= 1) { | ||
let playPromise = this.app.node.play(); | ||
@@ -444,5 +444,5 @@ if (playPromise !== undefined) { | ||
this.app.node.playbackRate = 1; | ||
} else if (bufferLength > 2 && bufferLength <= 3) { | ||
this.app.node.playbackRate = 1; | ||
// this.app.node.play(); | ||
} else if (bufferLength > 1) { | ||
//console.log("超过1", new Date().toLocaleDateString()); | ||
this.app.node.currentTime = this.app.node.buffered.end(0); | ||
let playPromise = this.app.node.play(); | ||
@@ -456,42 +456,67 @@ if (playPromise !== undefined) { | ||
} | ||
} else if (bufferLength > 3 && bufferLength <= 5) { | ||
this.app.node.playbackRate = 1.25; | ||
// this.app.node.play(); | ||
let playPromise = this.app.node.play(); | ||
if (playPromise !== undefined) { | ||
playPromise | ||
.then(() => { | ||
this.app.node.play(); | ||
}) | ||
.catch(() => {}); | ||
} | ||
// console.log('加速=1.25'); | ||
} else if (bufferLength > 5 && bufferLength <= 7) { | ||
this.app.node.playbackRate = 2; | ||
// this.app.node.play(); | ||
let playPromise = this.app.node.play(); | ||
if (playPromise !== undefined) { | ||
playPromise | ||
.then(() => { | ||
this.app.node.play(); | ||
}) | ||
.catch(() => {}); | ||
} | ||
// console.log('加速=2'); | ||
} else if (bufferLength > 7 && bufferLength <= 9) { | ||
this.app.node.playbackRate = 4; | ||
// this.app.node.play(); | ||
let playPromise = this.app.node.play(); | ||
if (playPromise !== undefined) { | ||
playPromise | ||
.then(() => { | ||
this.app.node.play(); | ||
}) | ||
.catch(() => {}); | ||
} | ||
// console.log('加速=4',bufferLength); | ||
} else if (bufferLength > 9) { | ||
// console.log('bufferLength>9',bufferLength) | ||
this.app.node.currentTime = this.app.node.buffered.end(0) - 2; | ||
this.app.node.playbackRate = 1; | ||
} | ||
// else if (bufferLength > 0 && bufferLength <= 3) { | ||
// let playPromise = this.app.node.play(); | ||
// if (playPromise !== undefined) { | ||
// playPromise | ||
// .then(() => { | ||
// this.app.node.play(); | ||
// }) | ||
// .catch(() => {}); | ||
// } | ||
// // this.app.node.play(); | ||
// this.app.node.playbackRate = 1; | ||
// } else if (bufferLength > 2 && bufferLength <= 3) { | ||
// this.app.node.playbackRate = 1; | ||
// // this.app.node.play(); | ||
// let playPromise = this.app.node.play(); | ||
// if (playPromise !== undefined) { | ||
// playPromise | ||
// .then(() => { | ||
// this.app.node.play(); | ||
// }) | ||
// .catch(() => {}); | ||
// } | ||
// } else if (bufferLength > 3 && bufferLength <= 5) { | ||
// this.app.node.playbackRate = 1.25; | ||
// // this.app.node.play(); | ||
// let playPromise = this.app.node.play(); | ||
// if (playPromise !== undefined) { | ||
// playPromise | ||
// .then(() => { | ||
// this.app.node.play(); | ||
// }) | ||
// .catch(() => {}); | ||
// } | ||
// // console.log('加速=1.25'); | ||
// } else if (bufferLength > 5 && bufferLength <= 7) { | ||
// this.app.node.playbackRate = 2; | ||
// // this.app.node.play(); | ||
// let playPromise = this.app.node.play(); | ||
// if (playPromise !== undefined) { | ||
// playPromise | ||
// .then(() => { | ||
// this.app.node.play(); | ||
// }) | ||
// .catch(() => {}); | ||
// } | ||
// // console.log('加速=2'); | ||
// } else if (bufferLength > 7 && bufferLength <= 9) { | ||
// this.app.node.playbackRate = 4; | ||
// // this.app.node.play(); | ||
// let playPromise = this.app.node.play(); | ||
// if (playPromise !== undefined) { | ||
// playPromise | ||
// .then(() => { | ||
// this.app.node.play(); | ||
// }) | ||
// .catch(() => {}); | ||
// } | ||
// // console.log('加速=4',bufferLength); | ||
// } else if (bufferLength > 9) { | ||
// // console.log('bufferLength>9',bufferLength) | ||
// this.app.node.currentTime = this.app.node.buffered.end(0) - 2; | ||
// } | ||
// else if (bufferLength > 9 && bufferLength <= 11) { | ||
@@ -583,3 +608,3 @@ // this.app.node.playbackRate = 5; | ||
} | ||
samples.map((sample) => { | ||
samples.map(sample => { | ||
sample.duration = | ||
@@ -594,3 +619,3 @@ adjustDuration > 0 ? sampleDuration + 1 : sampleDuration; | ||
if (this.options.clearBuffer) { | ||
numberOfFrames = numberOfFrames.map((total) => { | ||
numberOfFrames = numberOfFrames.map(total => { | ||
return (total * sampleDuration) / 1000; | ||
@@ -615,3 +640,3 @@ }); | ||
if (adjacentOffset) { | ||
this.keyframeCache = this.keyframeCache.filter((keyframePoint) => { | ||
this.keyframeCache = this.keyframeCache.filter(keyframePoint => { | ||
if (keyframePoint < adjacentOffset) { | ||
@@ -618,0 +643,0 @@ maxLimit = keyframePoint; |
Sorry, the diff of this file is too big to display
24497406
54212