How can I differentiate between image and video file types in Metafield?

How can I differentiate between image and video file types in Metafield?

Jack_Khan_Baba
Shopify Partner
95 8 15

Hi if i can select a metafield type File and check both the value image and video
now i did not understand on which base i can seperate them.
how i can access them 
11.PNG

here is code that i can try it is working fine if i can upload a image but i cant understand how i can get the video
code:
<div class="custom-file-type">

<img src="{{ product.metafields.custom.file.value | img_url:'master' }}">

 

</div>

 

it work fine but if the user select the video so how i can access it any suggestion how i can differentiate on the base of file type.
if there is video it show the video and if user select the imaage it display the image 
please help

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Chat on WhatsApp: +923143054166
Need a Shopify developer? Hire us at naimatullahts335@gmail.com
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
Replies 2 (2)

Jason
Shopify Partner
11206 226 2314

You can look at the media type. It will return image for images, and generic_file for everything else. That should be good enough for you to know that's a video in your example. The file extension would also give you a very strong indicator of the file type.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Jack_Khan_Baba
Shopify Partner
95 8 15

i understand the type but could you right a few line of code according to given contion it very helpful for me thanks

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
Chat on WhatsApp: +923143054166
Need a Shopify developer? Hire us at naimatullahts335@gmail.com
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.