🍏 (chilled cow) remove music on ios
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
import 'youtube-video-js'
|
import 'youtube-video-js'
|
||||||
import { defineComponent, onMounted, watchEffect } from '@vue/composition-api'
|
import { defineComponent, onMounted, watchEffect } from '@vue/composition-api'
|
||||||
|
|
||||||
|
const iOS = navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ChilledMusic',
|
name: 'ChilledMusic',
|
||||||
props: {
|
props: {
|
||||||
@@ -19,11 +21,17 @@ export default defineComponent({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props, { emit }) {
|
||||||
|
if (iOS) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let chilledcow: HTMLVideoElement | null = null
|
let chilledcow: HTMLVideoElement | null = null
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
chilledcow = document.querySelector('youtube-video')
|
chilledcow = document.querySelector('youtube-video')
|
||||||
|
chilledcow?.addEventListener('pause', () => {
|
||||||
|
emit('pause')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
:session="session"
|
:session="session"
|
||||||
/>
|
/>
|
||||||
<div v-if="timeState === 'stopped'">
|
<div v-if="timeState === 'stopped'">
|
||||||
<label for="interval">intervale : </label>
|
|
||||||
<input
|
<input
|
||||||
id="interval"
|
id="interval"
|
||||||
name="interval"
|
name="interval"
|
||||||
|
placeholder="intervale"
|
||||||
v-model.number="interval"
|
v-model.number="interval"
|
||||||
type="number"
|
type="number"
|
||||||
step="1"
|
step="1"
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<button v-show="timeState === 'stopped'" @click="start">commencer</button>
|
<button v-show="timeState === 'stopped'" @click="start">commencer</button>
|
||||||
<button v-show="timeState === 'started'" @click="clear">arrêter</button>
|
<button v-show="timeState === 'started'" @click="clear">arrêter</button>
|
||||||
</div>
|
</div>
|
||||||
<ChilledMusic :play="timeState === 'started'" />
|
<ChilledMusic :play="timeState === 'started'" @pause="clear" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user