2018-03-26 21:54:38 +09:00
|
|
|
<template>
|
|
|
|
<div class="mk-media-video-dialog">
|
|
|
|
<div class="bg" @click="close"></div>
|
2019-02-03 19:33:23 +09:00
|
|
|
<video :src="video.url" :title="video.name" controls autoplay ref="video" @volumechange="volumechange"/>
|
2018-03-26 21:54:38 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2019-01-18 13:06:11 +09:00
|
|
|
import anime from 'animejs';
|
2018-03-26 21:54:38 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: ['video', 'start'],
|
|
|
|
mounted() {
|
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
|
|
|
opacity: 1,
|
|
|
|
duration: 100,
|
|
|
|
easing: 'linear'
|
|
|
|
});
|
2019-02-03 19:33:23 +09:00
|
|
|
const videoTag = this.$refs.video as HTMLVideoElement;
|
2018-03-26 21:54:38 +09:00
|
|
|
if (this.start) videoTag.currentTime = this.start
|
2019-02-03 19:33:23 +09:00
|
|
|
videoTag.volume = this.$store.state.device.mediaVolume;
|
2018-03-26 21:54:38 +09:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
close() {
|
|
|
|
anime({
|
|
|
|
targets: this.$el,
|
|
|
|
opacity: 0,
|
|
|
|
duration: 100,
|
|
|
|
easing: 'linear',
|
2018-09-15 21:53:04 +09:00
|
|
|
complete: () => this.destroyDom()
|
2018-03-26 21:54:38 +09:00
|
|
|
});
|
2019-02-03 19:33:23 +09:00
|
|
|
},
|
|
|
|
volumechange() {
|
|
|
|
const videoTag = this.$refs.video as HTMLVideoElement;
|
|
|
|
this.$store.commit('device/set', { key: 'mediaVolume', value: videoTag.volume });
|
|
|
|
},
|
2018-03-26 21:54:38 +09:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.mk-media-video-dialog
|
|
|
|
display block
|
|
|
|
position fixed
|
|
|
|
z-index 2048
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 100%
|
|
|
|
opacity 0
|
|
|
|
|
|
|
|
> .bg
|
|
|
|
display block
|
|
|
|
position fixed
|
|
|
|
z-index 1
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
width 100%
|
|
|
|
height 100%
|
2018-04-29 08:51:17 +09:00
|
|
|
background rgba(#000, 0.7)
|
2018-03-26 21:54:38 +09:00
|
|
|
|
|
|
|
> video
|
|
|
|
position fixed
|
|
|
|
z-index 2
|
|
|
|
top 0
|
|
|
|
right 0
|
|
|
|
bottom 0
|
|
|
|
left 0
|
|
|
|
max-width 80vw
|
|
|
|
max-height 80vh
|
|
|
|
margin auto
|
|
|
|
|
|
|
|
</style>
|