Copied to clipboard

Flag this post as spam?

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


  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 08:13
    Thomas T
    0

    How to upload video in media section in Umbraco7 ?

    Hi,

        I need to upload videos as like as images in media section. I tried with 'upload' datatype. But it didn't work.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 26, 2015 @ 08:22
    Jan Skovgaard
    0

    Hi Thomas

    What is the size of the video you're trying to upload? Vidoes are just treated as the type "File". So if you upload a video manually you need to go to the media section and create a media type of "File" and then use the upload option.

    You can also just drag and drop the file where you want it.

    If it's giving you a yellow screen it's most likely because you need to increase the maximum upload size in the web.config - You can see how to do that in Jeavon's first tip here http://24days.in/umbraco/2013/6-easy-configuration-tweaks/

    Be aware that in .NET there is a limit of 2GB - So if the video is larger than that you need to consider another way of dealing with it using youtube/vimeo for instance if it's a public video - Then it can just be embedded onto your site using the embed code. Otherwise you can also consider simply uploading the video to a specific video folder on your file-system and then read it from there.

    Hope this helps.

    /Jan

  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 08:48
    Thomas T
    0

    Hi Jan,

                 I tried to upload .mp4 video  in file format under media section as you told. But when I click save button, the respective method which is under 'umbraco/backoffice/umbracoApi/Media/postsave'  loaded for 3 mins 27 secs and threw '502 Bad Gateway' error.

  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 10:21
    Thomas T
    0

    Hi Jan,

                       I tried to upload 9mb video file...But it didn't save...

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 26, 2015 @ 10:56
    Jan Skovgaard
    0

    Hi Thomas

    Ok - But did you increase the max upload limit? If you don't do it the default is set to allow for uploading around 4mb - Again a thing related to the .NET framework.

    So unless you increase the maximum allowed upload size you won't succeed.

    However a 502 Bad Gateway error sounds weird...but try increasing the upload size if you have not already done so. If you still get the above error then you might need to adjust other settings as well - But frankly I can't remember those but will post if I come to think of them.

    /Jan

  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 13:55
    Thomas T
    0

    Hi Jan,

                     I changed web config. Now it works. But it takes nearly 3 and half minutes to upload....I have to wait each and every time without knowing whether it is uploading or not.... Now, I need to show those files in browser. I use razor code to read out details for videos like title, decription and video. The code displays everything but not video.....What is the syntax to show video in razor ?

  • Suniel Rampadarath 1 post 71 karma points
    Oct 30, 2019 @ 12:45
    Suniel Rampadarath
    0

    Greetings, I have the same issue. How can I upload the video (mp4) in the Umbraco CMS ?.

    Suniel Rampadarath

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 26, 2015 @ 14:00
    Jan Skovgaard
    0

    Hi Thomas

    Ok, are you uploading on a local installation or are you uploading to a server? Could be the bandwidth...But good you got it working.

    Could you provide the current code you're using? It will make it easier to give some advice.

    /Jan

  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 14:29
    Thomas T
    0

    Hi Jan,

                I uploaded in server.Files are there in respective locations...i tried with multiple syntax.those are as follows

     <iframe frameborder="0" src="@(video.GetPropertyValue<string>("umbracoFile"))"></iframe> --- not supported

     It shows message as 'The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.'

    <source src="@(video.GetPropertyValue<string>("umbracoFile"))" type="video/mp4">

    For this, mp3 file is showed....


     

  • Thomas T 66 posts 227 karma points
    Feb 26, 2015 @ 15:36
    Thomas T
    0

    Hi,

            I want to show videos in .flv, .wmv, .mp4, .swf formats. I can upload all formats of videos. But how can I display those videos in page. I need code for that..Before that, I need to whether it is possible or not ?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 26, 2015 @ 16:53
    Jan Skovgaard
    0

    Hi Thomas

    It is possible to show these videos. But depending on what devices you need to target you should know that you will most likely need the same video to be available in more formats to serve the broadest range of devices possible.

    Ok, so in order to be able to have the videos displayed you need to

    1: Fetch the path for the desired video (Razor) 2: Some <video> markup 3: Perhaps a JavasSript library to add some player actions like videojs for instance http://www.videojs.com/

    The code you showed me above - Is that your full code? If not then please paste the full code. It makes it much easier to point things out you should correct etc.

    /Jan

  • Thomas T 66 posts 227 karma points
    Feb 27, 2015 @ 08:17
    Thomas T
    0

    Hi Jan,

                       I need to know how to fetch the video path from media section through razor..My code is below

     

     @{var mediaFolderId = (int)CurrentPage.VideoMediaFolder; }

    @if (mediaFolderId > 0)

    {

        var mediaFolder = Umbraco.TypedMedia(mediaFolderId);

        var videos = mediaFolder.Children(x => x.DocumentTypeAlias == "File").ToList();

        var count = 0;

    foreach (var video in videos)

          {

               <div class="col-md-6 videosize">

                   <div class="col-md-8">

                       <div style="margin: 0 auto;text-align:center;" class="flex-video1 widescreen1">

                           <iframe frameborder="0" width="200" height="200" src="@(video.GetPropertyValue<string>("umbracoFile"))"></iframe>

                       </div>

                   </div>

                   <div class="col-md-4">

                       <h3>@(video.GetPropertyValue<string>("videotitle")) </h3>

                       <p>@(video.GetPropertyValue<string>("videodescription")) </p>

           </div>

                   <div>  

                           <video width="320" height="240" controls>

                                <source src="@(video.GetPropertyValue<string>("umbracoFile"))" type="video/mp4">

                           </video>

                  </div>

            </div>

            }

    }

  • Thomas T 66 posts 227 karma points
    Feb 27, 2015 @ 11:05
    Thomas T
    0

    Hi Jan, 

                     What is the razor syntax for fetching the video from media section ? I used "iframe" and "video" tags as posted in last reply..

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 27, 2015 @ 11:09
    Jan Skovgaard
    0

    Hi Thomas

    Thanks for the code - I hope i'll have some time to have a closer look during the weekend. Don't have time to do it today. So unless someone else beats me to it I can't provide an example before sunday.

    But you should not use "iframe" for embedding videos. It's the <video> tag you need HTML wise.

    /Jan

  • Thomas T 66 posts 227 karma points
    Mar 02, 2015 @ 12:57
    Thomas T
    0

    Hi Jan,

                    Do u have any example for this ?
     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 02, 2015 @ 16:51
    Jan Skovgaard
    100

    Hi Thomas

    Sorry for the late reply - I fogot about it yesterday.

    But below you can see my working code

    @{
      var mediaFolderId = CurrentPage.Videos;
    }
    
    @if(!String.IsNullOrEmpty(mediaFolderId.ToString())){                   
      var mediaFolder = Umbraco.Media(mediaFolderId);
    
      foreach (var video in mediaFolder.Children()) {                       
         <video autoplay controls width="320" height="240">
            <source src="@video.umbracoFile" type="video/mp4" />
         </video>                   
      }
    
    }
    

    In the above it seems like you're mixing up dynamics and strongly typed. My example is based on dynamics.

    For each video you need to have some fallback options since browsers support different formats. This articles does a good job of explaining this http://diveintohtml5.info/video.html

    So to be covered fully you'll need the same video in the .ogg, .mp4 and .webm formats.

    I hope this helps.

    /Jan

  • Thomas T 66 posts 227 karma points
    Mar 03, 2015 @ 08:34
    Thomas T
    0

    Hi Jan,

                 Now it is working for the formats what u mentioned. Thanks for the help.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 03, 2015 @ 08:59
    Jan Skovgaard
    0

    Hi Thomas

    Happy to hear that it worked out - Remember to mark the post that solved your issue as the solution.

    Happy coding!

    /Jan

  • Tessa 20 posts 72 karma points
    Aug 10, 2015 @ 13:16
    Tessa
    0

    I can't seem to upload MP4 videos into the media section at all. I followed that link and increased the upload size in the web.config, but I'm still only seeing this error:

    Request error: The URL returned a 404 (not found): 
    /umbraco/backoffice/UmbracoApi/Media/PostSave
    with data: 
    {"key":"contentItem","value":{"id":0,"properties":[{"id":0,"alias":"umbracoFile","value":{"selectedFiles":"video.mp4.mp4"}},{"id":0,"alias":"umbracoExtension","value":""},{"id":0,"alias":"umbracoBytes","value":""}],"name":"Example 2","contentTypeAlias":"File","parentId":1126,"action":"saveNew"}}
    Contact your administrator for information.
    

    The mimetypes are also in the web.config, so I don't know what's wrong. Is something messed up with my Umbraco installation since it's giving a 404? Uploading images are fine. I've been uploading JPGs and PNGs for a while now.

Please Sign in or register to post replies

Write your reply to:

Draft