Copied to clipboard

Flag this post as spam?

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


  • malar 97 posts 206 karma points
    May 01, 2018 @ 17:40
    malar
    0

    Video is not displaying content part

    Hi

    I uploaded video in Media. In the content part , i am trying to upload video, it is not showing video . it is displaying only image. when i open media , it is displaying video . i can not take video from media.

    Media video

    enter image description here

    Content part enter image description here

  • pranjal 75 posts 188 karma points
    May 02, 2018 @ 06:10
    pranjal
    0

    I don't get your Question please elaborate what you have to do ?

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 02, 2018 @ 06:26
    Dave Woestenborghs
    0

    Hi Malar,

    I think the problem is that your media picker is configured to only allow picking of images.

    Can you check that ?

    Dave

  • malar 97 posts 206 karma points
    May 02, 2018 @ 07:59
    malar
    0

    Yes , The problem is media picker. Now video is displaying. Thanks for your comments. I have written below video code. it is displaying some error . Can you please check that . Can you please share , what is the mistake.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{

    var newsNodes = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "nyhed");
    

    } @foreach (var news in newsNodes) {

        <div class="box">
            <a href="@news.Url">
                <div class="newsContainer row">             
                    <div class="newsImg col-md-5 col-lg-4">
                     @{
    
                        var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("videoMP");
                      if (typedMediaPickerSingle != null)
                      {
                            <video autoplay controls width="320" height="240">
                             <source src="@typedMediaPickerSingle.Url.umbracoFile" type="video/mp4" />
                             </video> 
                    }
    
                 var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("image");
                 else if(typedMediaPickerSingle != null)
                {
    
                   <img  src="@typedMediaPickerSingle.Url"/>
                }
                else {
    
                 <img  src="http://localhost:61946/media/1053/templatedeo.png" />
                }
             }  
                    </div>          
                    <div class="newsText col-md-7 col-lg-8">
    
                        <h1>@news.GetPropertyValue("title")</h1>
    
                    </div>
                </div>
            </a>
    
        </div>
    }
    

    see my error.

    enter image description here

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 02, 2018 @ 08:01
    Dave Woestenborghs
    0

    Hi Malar,

    I think you need to change this part. You have a problem with your if else statement

    @{
    
                        var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("videoMP");
                      if (typedMediaPickerSingle != null)
                      {
                            <video autoplay controls width="320" height="240">
                             <source src="@typedMediaPickerSingle.Url" type="video/mp4" />
                             </video> 
                    }
    
                 var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("image");
                 if(typedMediaPickerSingle != null)
                {
    
                   <img  src="@typedMediaPickerSingle.Url"/>
                }
                else {
    
                 <img  src="http://localhost:61946/media/1053/templatedeo.png" />
                }
             }  
    

    Dave

  • malar 97 posts 206 karma points
    May 02, 2018 @ 08:14
    malar
    0

    Yes , If statement, i have video , it is displaying now. At the same time else statement also displaying.

    Caan you please see my output.

    enter image description here

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 02, 2018 @ 08:17
    Dave Woestenborghs
    0

    Hi Malar,

    Can you try this

                    var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("videoMP");
                  if (typedMediaPickerSingle != null)
                  {
                        <video autoplay controls width="320" height="240">
                         <source src="@typedMediaPickerSingle.Url" type="video/mp4" />
                         </video> 
                }
                else {
                    var typedMediaPickerSingle = news.GetPropertyValue<IPublishedContent>("image");
             if(typedMediaPickerSingle != null)
            {
    
               <img  src="@typedMediaPickerSingle.Url"/>
            }
            else {
    
             <img  src="http://localhost:61946/media/1053/templatedeo.png" />
            }
                }
    

    Dave

  • malar 97 posts 206 karma points
    May 02, 2018 @ 08:25
    malar
    100

    Hi Dave,

    It is working now . Thank you very much for your kind guidance.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    May 02, 2018 @ 08:28
    Dave Woestenborghs
    0

    Hi Malar,

    You are welcome. Don't forget to mark the topic as solved.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft