Media link fields
only return { "link_type": "media" }
for me in nuxt.js. I can't access any url field, although I have definitely set a media item in the dashboard. This also occurs for the simple link field
. How do I get the actual url for the media item (mp4 video in this case)?
Hi Visionautik,
Welcome to the Prismic community, I will try to help you with this.
For videos, we recommend that you host them through a specialized service such as YouTube or Vimeo. These services offer video compression support and both provide an excellent video player.
By doing this, you can easily add your videos to your Prismic documents by using the Embed field
Refer to this documentation for more info.
Please let us know if you need any further help,
Fares
Also apart from the solution that I gave (using an external service), I think the issue you are having is probably because you didn’t publish the document.
Can send me the name of your repository so that I check if the image exists throwout the API.
This issue has been closed due to inactivity.
We're using 'Link to media' to serve our video and we can confirm that only link_type
is accessible in Typescript (Next.js).
We have been using Cloudflare Stream to serve our videos, but after some tests we're finding that your CDN is far superior for delivery.
As a work around for now, we're doing the following:
const video = slice.primary.video as any
- we're then doing video.url
to get the link within our video player.
Could suggest the correct way to get the URL, please?
Hello @james6
Thanks for reaching out to us.
I believe it should be possible to get the URL of a video. I would like to should investigate your API. I need the following:
- Your repo name.
- Name of the Custom Type where you are adding the video.
Thanks,
Priyanka
Hello @Priyanka,
Almost as @james6, I prefer prismic CDN to serve my medias and I'm doing the following :
const video = slice.primary.media as FilledLinkToMedia;
but, as you see, I need to explicit the type FilledLinkToMedia
in order to get video.url
accessible in Typescript (Next.js)
Then same question as @james6 :
Could you suggest the correct way to get the URL, please?
Regards,
That is the correct way to get the video url.