Can I use this to play local files?
danieljbrennan opened this issue · comments
I just want to play local videos that are on my server. I can't seem to get this it work.
Sure thing, you can. Can I see how you are using it that's making it not to work for you?
<template>
<div>
<Media
:kind="'video'"
:controls="true"
:src="['../assets/apples1.mp4']"
>
</Media>
</div>
</template>
<script>
import Media from '@dongido/vue-viaudio'
export default {
name: "Video",
components: {
Media
}
}
</script>
I've tried a few different paths.
This component is in <project_root>/src/components, and the video is in <project_root>/src/assets
Thanks for your help.
Here is a demo: https://codesandbox.io/s/vue-template-pdqhz?fontsize=14
So, you can grab the audio using:
<Media :kind="'video'" :controls="true" :src="[require('@/assets/apples1.mp4')]"></Media>
OR
<Media :kind="'video'" :controls="true" :src="require('@/assets/apples1.mp4')"></Media>
Let me know if that works
That works!
Thanks. I needed the "require". Not sure how that works, but it does.