-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
I have been reading the docs and still confused on how to destroy the video. Right now if I go to a detail page and navigate back I can still hear the video playing. Here is what I have that doesnt work (causes crash)
In main.js
Vue.registerElement('VideoPlayer', () => require('nativescript-videoplayer').Video)
In my VideoDetail.vue page:
<template>
<Page backgroundColor="#242C3B" >
<ActionBar>
<StackLayout class="actionbar">
<Label :text="title" class="actionbar-title"/>
<Label :text="date" class="actionbar-date"/>
</StackLayout>
</ActionBar>
<StackLayout v-if="video">
<VideoPlayer
:src="video"
autoplay="true"
height="300"
loop="false"
muted="false"
ref="lessonVideo"
>
</VideoPlayer>
</StackLayout>
</Page>
</template>
<script>
export default {
data() {
return {
video: 'https://myvideolink.mp4'
}
}
beforeDestroy(){
this.$refs.lessonVideo.destroy();
}
}
</script>
Metadata
Metadata
Assignees
Labels
No labels