This is image code . I want to make ,if condition is video , else if is image , else is same like that. Do you have any documention. Can you please help me.
A quick solution would be to retrieve the value of your media picker as a string, then check if it ends with the appropriate file extensions (.avi, .flv, .mp4, etc).
Like so:
string mediaPicker = "www.example.test/video.mp4";
string[] extensions = {".avi", ".flv", ".wmv", ".mp4", ".mov" };
// Check if string ends in any of the extensions
// Use .ToLower() to format possible extensions to lowercase
if (extensions.Any(x => mediaPicker.ToLower().EndsWith(x)))
{
// do something
}
This isn't the most robust solution, as there's no guarantee the file is actually a media file, even with the extensions, but it should hopefully do the trick.
Video media picker
Hi ,
I need to make Video media picker. Right now i wrote image media picker. I learnt from this documentation.
https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker2
This is image code . I want to make ,if condition is video , else if is image , else is same like that. Do you have any documention. Can you please help me.
Can you please help me.
Hi,
Please help me anyone.
Maybe not entirely what you are looking for, but I created a property editor that allows embedding of youtube, vimeo, etc...
https://our.umbraco.org/projects/backoffice-extensions/oembed-picker-property-editor/
Dave
Hi Jhon,
Did you find a solution yet? I am in the same situation
A quick solution would be to retrieve the value of your media picker as a string, then check if it ends with the appropriate file extensions (
.avi
,.flv
,.mp4
, etc).Like so:
This isn't the most robust solution, as there's no guarantee the file is actually a media file, even with the extensions, but it should hopefully do the trick.
is working on a reply...