fix video state sync, fixes #250.

This commit is contained in:
Miroslav Šedivý 2023-03-18 13:31:40 +01:00
parent ea99ce7753
commit 76fc892823
2 changed files with 17 additions and 4 deletions

View File

@ -22,10 +22,10 @@
@mouseenter.stop.prevent="onMouseEnter"
@mouseleave.stop.prevent="onMouseLeave"
/>
<div v-if="!playing && playable" class="player-overlay" @click.stop.prevent="toggle">
<div v-if="!playing && playable" class="player-overlay" @click.stop.prevent="playAndUnmute">
<i class="fas fa-play-circle" />
</div>
<div v-if="mutedOverlay && muted" class="player-overlay" @click.stop.prevent="unmute">
<div v-else-if="mutedOverlay && muted" class="player-overlay" @click.stop.prevent="unmute">
<i class="fas fa-volume-up" />
</div>
<div ref="aspect" class="player-aspect" />
@ -384,9 +384,16 @@
}
@Watch('playing')
onPlayingChanged(playing: boolean) {
async onPlayingChanged(playing: boolean) {
if (this._video && this._video.paused && playing) {
this.play()
// if autoplay is disabled, play() will throw an error
// and we need to properly save the state otherwise we
// would be thinking we're playing when we're not
try {
await this._video.play()
} catch (err: any) {
this.$accessor.video.pause()
}
}
if (this._video && !this._video.paused && !playing) {
@ -560,6 +567,11 @@
}
}
playAndUnmute() {
this.$accessor.video.play()
this.$accessor.video.setMuted(false)
}
unmute() {
this.$accessor.video.setMuted(false)
}

View File

@ -13,6 +13,7 @@
- Fixed keysym mapping for unknown keycodes, which was causing some key combinations to not work on some keyboards.
- Fixed a bug where `max_fps=0` would lead to an invalid pipeline.
- Fixed client side webrtc ICE gathering, so that neko can be used without exposed ports, only with STUN and TURN servers.
- Fixed play state synchronization, when autoplay is disabled.
### Misc
- Updated to go 1.19 and Node 18, removed go-events as dependency (by @mbattista).