I’d like to get a video file by .Resources.ByType "video". I have read the discussion before and I found that type video had been supported.
But in the same folder, there are 1.mp4 and 2.jpg. I can get 2.jpg by .Resources.ByType "image", but can not get 1.mp4 by .Resources.ByType "video" because the return value is an empty array.
I also look at mediaType.go, which shows that .mp4 is supported.
And I can not find why this happens.
Updates
After more tests, I found that video can be accessed by using its suffix. For example, I can access 1.mp4 by .Resources.ByType "mp4", and access 1.webm by .Resources.ByType "webm". But none of these can be accessed by .Resources.ByType "video".
But for images, I can use .Resources.ByType "image" to access it. If I use .Resources.ByType "png", the result will be empty, which is totally contradictory to videos.
This conflicting situation makes me feel very confused.
I just use {{ print (.Resources.ByType "video") }} which returns empty array. And in the same folder I have another jpg image. When I use {{ print (.Resources.ByType "image") }}, the result is right.
This is only a one line usage, but if you still think it is necessary to post a sample I can make one. Thank you for your fast reply!
After more tests, I found that video can be accessed by using its suffix. For example, I can access 1.mp4 by .Resources.ByType "mp4" , and access 1.webm by .Resources.ByType "webm" . But none of these can be accessed by .Resources.ByType "video" .
But for images, I can use .Resources.ByType "image" to access it. If I use .Resources.ByType "png" , the result will be empty, which is totally contradictory to videos.
This conflicting situation makes me feel very confused.