mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix #33
This commit is contained in:
parent
714075935f
commit
1f8b4d44c7
@ -312,8 +312,9 @@
|
|||||||
this._video.addEventListener('canplaythrough', () => {
|
this._video.addEventListener('canplaythrough', () => {
|
||||||
this.$accessor.video.setPlayable(true)
|
this.$accessor.video.setPlayable(true)
|
||||||
if (this.autoplay) {
|
if (this.autoplay) {
|
||||||
if (!document.hasFocus()) {
|
if (!document.hasFocus() || !this.$accessor.active) {
|
||||||
this.$accessor.video.setMuted(true)
|
this.$accessor.video.setMuted(true)
|
||||||
|
this._video.muted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@ -345,12 +346,16 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this._video
|
try {
|
||||||
.play()
|
this._video
|
||||||
.then(() => {
|
.play()
|
||||||
this.onResise()
|
.then(() => {
|
||||||
})
|
this.onResise()
|
||||||
.catch(err => this.$log.error(err))
|
})
|
||||||
|
.catch(err => this.$log.error)
|
||||||
|
} catch (err) {
|
||||||
|
this.$log.error(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
@ -379,7 +384,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onFocus() {
|
onFocus() {
|
||||||
if (!document.hasFocus()) {
|
if (!document.hasFocus() || !this.$accessor.active) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,6 +393,7 @@
|
|||||||
.readText()
|
.readText()
|
||||||
.then(text => {
|
.then(text => {
|
||||||
if (this.clipboard !== text) {
|
if (this.clipboard !== text) {
|
||||||
|
this.$accessor.remote.setClipboard(text)
|
||||||
this.$accessor.remote.sendClipboard(text)
|
this.$accessor.remote.sendClipboard(text)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -27,6 +27,15 @@ new Vue({
|
|||||||
store,
|
store,
|
||||||
render: h => h(app),
|
render: h => h(app),
|
||||||
created() {
|
created() {
|
||||||
|
const click = () => {
|
||||||
|
this.$accessor.setActive()
|
||||||
|
if (this.$accessor.settings.autoplay && this.$accessor.video.playing) {
|
||||||
|
this.$accessor.video.setMuted(false)
|
||||||
|
}
|
||||||
|
window.removeEventListener('click', click, false)
|
||||||
|
}
|
||||||
|
window.addEventListener('click', click, false)
|
||||||
|
|
||||||
this.$client.init(this)
|
this.$client.init(this)
|
||||||
this.$accessor.initialise()
|
this.$accessor.initialise()
|
||||||
},
|
},
|
||||||
|
@ -15,12 +15,17 @@ import * as emoji from './emoji'
|
|||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
username: get<string>('username', ''),
|
username: get<string>('username', ''),
|
||||||
password: get<string>('password', ''),
|
password: get<string>('password', ''),
|
||||||
|
active: false,
|
||||||
connecting: false,
|
connecting: false,
|
||||||
connected: false,
|
connected: false,
|
||||||
locked: false,
|
locked: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
export const mutations = mutationTree(state, {
|
export const mutations = mutationTree(state, {
|
||||||
|
setActive(state) {
|
||||||
|
state.active = true
|
||||||
|
},
|
||||||
|
|
||||||
setLogin(state, { username, password }: { username: string; password: string }) {
|
setLogin(state, { username, password }: { username: string; password: string }) {
|
||||||
state.username = username
|
state.username = username
|
||||||
state.password = password
|
state.password = password
|
||||||
|
Loading…
Reference in New Issue
Block a user