orchard/resources/cider-ui-tests/views/components/animatedartwork-view.ejs
2021-12-08 16:25:35 +07:00

47 lines
No EOL
1.5 KiB
Text

<script type="text/x-template" id="animatedartwork-view">
<template v-if="video">
<div class="animated" v-bind:vid="app.hashCode(video).toString()">
<video ref="video" class="animated-artwork-video" loop id="animated-artwork"></video>
</div>
</template>
</script>
<script>
Vue.component('animatedartwork-view', {
template: '#animatedartwork-view',
props: ['video', 'hls'],
mounted() {
if (this.video) {
this.$nextTick(function () {
var config = {
backBufferLength: 0,
enableWebVTT: false,
enableCEA708Captions: false,
emeEnabled: false,
abrEwmaDefaultEstimate: 10000,
testBandwidth: false
};
if (this.hls) {
console.log('detached');
this.hls.detachMedia();
} else {
this.hls = new Hls(config);
}
// bind them together
if (this.$refs.video) {
this.hls.attachMedia(this.$refs.video);
this.hls.loadSource(this.video);
this.hls.loadLevel = 4;
}
})
}
},
beforeDestroy() {
this.hls.detachMedia();
this.hls.destroy();
console.log('killed')
}
});
</script>