Fixed quality change
This commit is contained in:
parent
7a37250b39
commit
49a79c1b65
|
@ -98,7 +98,7 @@
|
|||
<v-card-text>
|
||||
<v-select
|
||||
:value="GET_SLPLAYERQUALITY"
|
||||
@input="SET_SLPLAYERQUALITY"
|
||||
@input="changeQuality"
|
||||
:items="qualitiesSelect"
|
||||
item-text="text"
|
||||
item-value="id"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<video-player
|
||||
ref="videoPlayer"
|
||||
:options="playerOptions"
|
||||
|
||||
@play="onPlayerPlay($event)"
|
||||
@pause="onPlayerPause($event)"
|
||||
@loadeddata="onPlayerLoadeddata($event)"
|
||||
|
@ -16,10 +15,10 @@
|
|||
@seeking="onPlayerSeeking($event)"
|
||||
@seeked="onPlayerSeeked($event)"
|
||||
@statechanged="playerStateChanged($event)"
|
||||
|
||||
@ready="playerReadied($event)"
|
||||
style="background-color:transparent !important;"
|
||||
class="ptplayer"
|
||||
>
|
||||
>
|
||||
</video-player>
|
||||
<div class="center" v-if="!src">
|
||||
Waiting...
|
||||
|
@ -29,13 +28,12 @@
|
|||
|
||||
<script>
|
||||
import { mapGetters, mapMutations } from 'vuex';
|
||||
|
||||
const request = require('request');
|
||||
|
||||
export default {
|
||||
props: ['server', 'metadata', 'initialOffset', 'src', 'initUrl', 'stopUrl', 'params', 'sources'],
|
||||
created() {
|
||||
|
||||
},
|
||||
created() {},
|
||||
data() {
|
||||
return {
|
||||
eventbus: window.EventBus,
|
||||
|
@ -131,10 +129,7 @@ export default {
|
|||
});
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('settings', [
|
||||
'GET_AUTOPLAY',
|
||||
'GET_SLPLAYERVOLUME'
|
||||
]),
|
||||
...mapGetters('settings', ['GET_AUTOPLAY', 'GET_SLPLAYERVOLUME']),
|
||||
player() {
|
||||
if (this.$refs && this.$refs.videoPlayer) {
|
||||
return this.$refs.videoPlayer.player;
|
||||
|
@ -161,9 +156,7 @@ export default {
|
|||
bufferStart: 0,
|
||||
bufferEnd: 0,
|
||||
|
||||
sources: [
|
||||
this.source,
|
||||
],
|
||||
sources: [this.source],
|
||||
controlBar: {
|
||||
children: {
|
||||
playToggle: {},
|
||||
|
@ -184,34 +177,26 @@ export default {
|
|||
|
||||
metadataImage() {
|
||||
const w = Math.round(Math.max(document.documentElement.clientWidth, window.innerWidth || 0));
|
||||
const h = Math.round(Math.max(document.documentElement.clientHeight, window.innerHeight || 0));
|
||||
const h = Math.round(
|
||||
Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
|
||||
);
|
||||
return this.server.getUrlForLibraryLoc(this.metadata.thumb, w / 12, h / 4);
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('settings', [
|
||||
'SET_SLPLAYERVOLUME'
|
||||
]),
|
||||
...mapMutations('settings', ['SET_SLPLAYERVOLUME']),
|
||||
// Player events
|
||||
closingPlayer() {
|
||||
},
|
||||
onPlayerPlay(player) {
|
||||
},
|
||||
onPlayerPause(player) {
|
||||
},
|
||||
onPlayerLoaded(player) {
|
||||
},
|
||||
closingPlayer() {},
|
||||
onPlayerPlay(player) {},
|
||||
onPlayerPause(player) {},
|
||||
onPlayerLoaded(player) {},
|
||||
onPlayerEnded(player) {
|
||||
this.$router.push('/browse');
|
||||
this.$emit('playbackEnded');
|
||||
},
|
||||
onPlayerCanplay(player) {
|
||||
},
|
||||
onPlayerCanplaythrough(player) {
|
||||
},
|
||||
onPlayerTimeupdate(player) {
|
||||
},
|
||||
onPlayerCanplay(player) {},
|
||||
onPlayerCanplaythrough(player) {},
|
||||
onPlayerTimeupdate(player) {},
|
||||
seekMethod(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const seekTo = data.time;
|
||||
|
@ -238,14 +223,24 @@ export default {
|
|||
return reject(new Error('Soft seek requested but not within buffered range'));
|
||||
}
|
||||
|
||||
if (((Math.abs(seekTo - this.lastTime) < 3000) && (!this.blockedSpeedChanges) && (this.$store.state.synclounge.lastHostTimeline.playerState === 'playing'))) {
|
||||
if (
|
||||
Math.abs(seekTo - this.lastTime) < 3000 &&
|
||||
!this.blockedSpeedChanges &&
|
||||
this.$store.state.synclounge.lastHostTimeline.playerState === 'playing'
|
||||
) {
|
||||
const oldSources = this.player.options_.sources;
|
||||
let cancelled = false;
|
||||
window.EventBus.$once('host-playerstate-change', () => {
|
||||
cancelled = true;
|
||||
});
|
||||
const clicker = setInterval(() => {
|
||||
if (cancelled || !this.player || this.isPlaying === 'paused' || this.isPlaying === 'buffering' || oldSources !== this.player.options_.sources) {
|
||||
if (
|
||||
cancelled ||
|
||||
!this.player ||
|
||||
this.isPlaying === 'paused' ||
|
||||
this.isPlaying === 'buffering' ||
|
||||
oldSources !== this.player.options_.sources
|
||||
) {
|
||||
clearInterval(clicker);
|
||||
this.player.playbackRate(1.0);
|
||||
return reject(new Error('Slow seek was stop due to buffering or pausing'));
|
||||
|
@ -265,22 +260,25 @@ export default {
|
|||
reject(new Error('Failed to slow seek as the playback rate did not want to change'));
|
||||
return clearInterval(clicker);
|
||||
}
|
||||
if (this.isPlaying === 'paused' || (lastPlayerTime === this.player.currentTime() * 1000)) {
|
||||
if (
|
||||
this.isPlaying === 'paused' ||
|
||||
lastPlayerTime === this.player.currentTime() * 1000
|
||||
) {
|
||||
return;
|
||||
}
|
||||
lastPlayerTime = this.player.currentTime * 1000;
|
||||
const slidingTime = seekTo + (25 * iterations);
|
||||
const slidingTime = seekTo + 25 * iterations;
|
||||
const current = Math.round(this.player.currentTime() * 1000);
|
||||
const difference = Math.abs(current - (slidingTime));
|
||||
const difference = Math.abs(current - slidingTime);
|
||||
if (current < slidingTime) {
|
||||
// Speed up
|
||||
// Speed up
|
||||
playbackSpeed += 0.0001;
|
||||
if (this.player.playbackRate() < 1.02) {
|
||||
this.player.playbackRate(playbackSpeed);
|
||||
}
|
||||
}
|
||||
if (current > slidingTime) {
|
||||
// Slow down
|
||||
// Slow down
|
||||
playbackSpeed -= 0.0001;
|
||||
if (this.player.playbackRate() > 0.98) {
|
||||
this.player.playbackRate(playbackSpeed);
|
||||
|
@ -308,7 +306,7 @@ export default {
|
|||
this.player.currentTime(seekTo / 1000);
|
||||
let ticks = 0;
|
||||
const ticker = setInterval(() => {
|
||||
if (!this.player || oldTime !== this.lastTime || (this.lastTime === (seekTo))) {
|
||||
if (!this.player || oldTime !== this.lastTime || this.lastTime === seekTo) {
|
||||
clearInterval(ticker);
|
||||
return resolve('Directly seeked');
|
||||
}
|
||||
|
@ -379,10 +377,8 @@ export default {
|
|||
}, 10000);
|
||||
send();
|
||||
},
|
||||
onPlayerPlaying(player) {
|
||||
},
|
||||
onPlayerWaiting(player) {
|
||||
},
|
||||
onPlayerPlaying(player) {},
|
||||
onPlayerWaiting(player) {},
|
||||
onPlayerSeeking(player) {
|
||||
this.$emit('timelineUpdate', {
|
||||
time: this.player.currentTime() * 1000,
|
||||
|
@ -431,11 +427,10 @@ export default {
|
|||
},
|
||||
playerReadied(player) {
|
||||
this.player.volume(this.GET_SLPLAYERVOLUME);
|
||||
this.player.currentTime(this.initialOffset / 1000);
|
||||
this.player.currentTime(Math.round(this.initialOffset / 1000));
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue