Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jhon 87 posts 161 karma points
    Apr 26, 2018 @ 07:58
    Jhon
    0

    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.

    @{
                var typedMediaPickerSingle = debat.GetPropertyValue<IPublishedContent>("image");
                if (typedMediaPickerSingle != null)
                {
    
                   <img  class="debatImage" src="@typedMediaPickerSingle.Url"/>
                }
                else {
    
                 <img class="debatImage" src="http://localhost:61946/media/1053/templatedeo.png" />
                }
             } 
    
  • Jhon 87 posts 161 karma points
    Apr 26, 2018 @ 08:41
    Jhon
    0

    Can you please help me.

  • Jhon 87 posts 161 karma points
    Apr 30, 2018 @ 07:57
    Jhon
    0

    Hi,

    Please help me anyone.

  • Dave Woestenborghs 3189 posts 10601 karma points MVP 3x admin c-trib
    Apr 30, 2018 @ 09:06
    Dave Woestenborghs
    0

    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

  • Raluca Dumitru 12 posts 101 karma points
    Jan 11, 2019 @ 14:32
    Raluca Dumitru
    0

    Hi Jhon,

    Did you find a solution yet? I am in the same situation

  • Rhys Hamilton 100 posts 628 karma points
    Jan 11, 2019 @ 15:54
    Rhys Hamilton
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft