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

    Hi ,

    I need to make Video media picker. Right now i wrote image media picker. I learnt from this documentation.

    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

    Can you please help me.

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


    Please help me anyone.

  • Dave Woestenborghs 3203 posts 10697 karma points MVP 4x admin c-trib
    Apr 30, 2018 @ 09:06
    Dave Woestenborghs

    Maybe not entirely what you are looking for, but I created a property editor that allows embedding of youtube, vimeo, etc...


  • Raluca Dumitru 19 posts 128 karma points
    Jan 11, 2019 @ 14:32
    Raluca Dumitru

    Hi Jhon,

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

  • Rhys Hamilton 138 posts 891 karma points
    Jan 11, 2019 @ 15:54
    Rhys Hamilton

    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: