mirror of https://bitbucket.org/ausocean/av.git
mjpeg-player: naming
This commit is contained in:
parent
c10a6f7bb1
commit
1243a8606e
|
@ -16,8 +16,8 @@ export default class LevelController extends EventHandler {
|
|||
Event.LEVEL_LOADED);
|
||||
|
||||
this.canload = false;
|
||||
this.currentLevelIndex = 0;
|
||||
this.manualLevelIndex = -1;
|
||||
this.currentLvlIdx = 0;
|
||||
this.manualLvlIdx = -1;
|
||||
this.timer = null;
|
||||
|
||||
chromeOrFirefox = /chrome|firefox/.test(navigator.userAgent.toLowerCase());
|
||||
|
@ -25,7 +25,7 @@ export default class LevelController extends EventHandler {
|
|||
|
||||
onHandlerDestroying() {
|
||||
this.clearTimer();
|
||||
this.manualLevelIndex = -1;
|
||||
this.manualLvlIdx = -1;
|
||||
}
|
||||
|
||||
clearTimer() {
|
||||
|
@ -79,12 +79,6 @@ export default class LevelController extends EventHandler {
|
|||
videoCodecFound = videoCodecFound || !!level.videoCodec;
|
||||
audioCodecFound = audioCodecFound || !!level.audioCodec;
|
||||
|
||||
// erase audio codec info if browser does not support mp4a.40.34.
|
||||
// demuxer will autodetect codec and fallback to mpeg/audio
|
||||
if (chromeOrFirefox && level.audioCodec && level.audioCodec.indexOf('mp4a.40.34') !== -1) {
|
||||
level.audioCodec = undefined;
|
||||
}
|
||||
|
||||
levelFromSet = levelSet[level.bitrate]; // FIXME: we would also have to match the resolution here
|
||||
|
||||
if (!levelFromSet) {
|
||||
|
@ -147,14 +141,14 @@ export default class LevelController extends EventHandler {
|
|||
}
|
||||
|
||||
get level() {
|
||||
return this.currentLevelIndex;
|
||||
return this.curLvlIdx;
|
||||
}
|
||||
|
||||
set level(newLevel) {
|
||||
let levels = this._levels;
|
||||
if (levels) {
|
||||
newLevel = Math.min(newLevel, levels.length - 1);
|
||||
if (this.currentLevelIndex !== newLevel || !levels[newLevel].details) {
|
||||
if (this.curLvlIdx !== newLevel || !levels[newLevel].details) {
|
||||
this.setLevelInternal(newLevel);
|
||||
}
|
||||
}
|
||||
|
@ -167,9 +161,9 @@ export default class LevelController extends EventHandler {
|
|||
if (newLevel >= 0 && newLevel < levels.length) {
|
||||
// stopping live reloading timer if any
|
||||
this.clearTimer();
|
||||
if (this.currentLevelIndex !== newLevel) {
|
||||
if (this.curLvlIdx !== newLevel) {
|
||||
console.log(`switching to level ${newLevel}`);
|
||||
this.currentLevelIndex = newLevel;
|
||||
this.curLvlIdx = newLevel;
|
||||
const levelProperties = levels[newLevel];
|
||||
levelProperties.level = newLevel;
|
||||
hls.trigger(Event.LEVEL_SWITCHING, levelProperties);
|
||||
|
@ -196,11 +190,11 @@ export default class LevelController extends EventHandler {
|
|||
}
|
||||
|
||||
get manualLevel() {
|
||||
return this.manualLevelIndex;
|
||||
return this.manualLvlIdx;
|
||||
}
|
||||
|
||||
set manualLevel(newLevel) {
|
||||
this.manualLevelIndex = newLevel;
|
||||
this.manualLvlIdx = newLevel;
|
||||
if (this._startLevel === undefined) {
|
||||
this._startLevel = newLevel;
|
||||
}
|
||||
|
@ -251,14 +245,14 @@ export default class LevelController extends EventHandler {
|
|||
}
|
||||
|
||||
loadLevel() {
|
||||
console.log('call to loadLevel, index: ' + this.currentLevelIndex + "canload: " + this.canload);
|
||||
console.log('call to loadLevel, index: ' + this.curLvlIdx + "canload: " + this.canload);
|
||||
|
||||
if (this.currentLevelIndex !== null && this.canload) {
|
||||
const levelObject = this._levels[this.currentLevelIndex];
|
||||
if (this.curLvlIdx !== null && this.canload) {
|
||||
const levelObject = this._levels[this.curLvlIdx];
|
||||
|
||||
if (typeof levelObject === 'object' &&
|
||||
levelObject.url.length > 0) {
|
||||
const level = this.currentLevelIndex;
|
||||
const level = this.curLvlIdx;
|
||||
const id = levelObject.urlId;
|
||||
const url = levelObject.url[id];
|
||||
|
||||
|
@ -270,8 +264,8 @@ export default class LevelController extends EventHandler {
|
|||
}
|
||||
|
||||
get nextLoadLevel() {
|
||||
if (this.manualLevelIndex !== -1) {
|
||||
return this.manualLevelIndex;
|
||||
if (this.manualLvlIdx !== -1) {
|
||||
return this.manualLvlIdx;
|
||||
} else {
|
||||
return this.hls.nextAutoLevel;
|
||||
}
|
||||
|
@ -279,7 +273,7 @@ export default class LevelController extends EventHandler {
|
|||
|
||||
set nextLoadLevel(nextLevel) {
|
||||
this.level = nextLevel;
|
||||
if (this.manualLevelIndex === -1) {
|
||||
if (this.manualLvlIdx === -1) {
|
||||
this.hls.nextAutoLevel = nextLevel;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue