Results 1 to 6 of 6

Thread: No preview of videos?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    No preview of videos?

    I've attached a screenshot of my personal website that has videos. I'm not sure why it's doing what it is but for some reason, there is no preview or image that shows up in the image player. Usually you will see an image within a video player but mine isn't doing that. Below is the code that loads my videos onto the page.

    Code:
        <script>
            function getVideos(dirLocation) {
                var dir = dirLocation;
    
                if (dir == "img/Videos/") {
                        var fileextension = "mp4";
                
                        $.ajax({
                        //This will retrieve the contents of the folder if the folder is configured as 'browsable'
                        url: dir,
    
                        success: function(data) {
                            //This empty() statement clears the canvas so a new directory can be reloaded
                            $("#myImages").empty();
    
                            //List all png file names in the page
                            $(data).find("a:contains(" + fileextension + ")").each(function() {
                                var pathName = this.href;
                                var strLen = pathName.lastIndexOf('/');
                                var fileName = pathName.substring(pathName.lastIndexOf('/') + 1);
                                var newFileName = pathName.slice(0, strLen, pathName) + "/" + dir + fileName;
                                
                                var div = "<div style='width: 100%; margin: auto auto'><div class='imgContainer'>" +
                                        "<div class='gallery'>" +
                                        "<a href=" + newFileName + " target='_blank'>" +
                                        "<video width='600' height='400' controls>" +
                                        "<source src=" + newFileName + "type='video/mp4'>" +
                                        "<source src=" + fileName + "ogg" + "type='video/ogg'></video>" + 
                                        "</a>" +
                                        "</div>" + "</div>";
    
                                $("#myImages").append($(div));
                            });
                        }
                    });                
                }
            }
        </script>

    Thanks,
    Attached Images Attached Images  
    Blake

  2. #2

    Re: No preview of videos?

    Hii,

    If you want to show a poster of image within the video so just try this...

    <video width="320" height="240" poster="path of your image" controls>
    <source src="movie.mp4" type="video/mp4">
    <source src="movie.ogg" type="video/ogg">
    </video>

    Hope it will help you...

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: No preview of videos?

    So I'm assuming this has to be in a correct image format such as *.jpg, *.gif, *.png, etc.?
    Blake

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: No preview of videos?

    Unfortunately, this didn't work right. It almost does...here is what it looks like now...
    Attached Images Attached Images  
    Blake

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: No preview of videos?

    Nevermind...I got them to show up.

    Thanks for your help!
    Blake

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: No preview of videos?

    Ok, not the same issue but related to topic.

    How can I show the duration of a video like Youtube? See attached image.

    Thanks,
    Attached Images Attached Images  
    Blake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width