Search code examples
jqueryloadingbrightcove

Show loading image if Brightcove video is taking time to load on the page


I am using Brightcove video but its take a few seconds to appear/display on the screen. So in the meantime I want want to display the loading.gif image while the video is not loaded and once it loaded then hide loading.gif.

How to check if a Brightcove video is displaying on screen or not?


Solution

  • put your code here on how you are loading and showing the video

    i dont know how you are loading your video.. but heres a example on a ajax call processing some operations in server side.

      function ShowVideo(){}
    
      $("#div_Video" ).html("<img src='http://preloaders.net/preloaders/728/Skype%20balls%20loader.gif' />");
    
            $.ajax({
                cache: false,
                type: 'GET',
                contentType: "application/json",
                url: "getVideo.....",
                success: function (data) {
                    $("#div_Video").html(data); //replace the div with your video after loaded.. (i dont know how you are loading..)
                },
                fail: function (jqXHR, textStatus) {
                    alert("Error: " + textStatus);
                }
            });
    

    }

    first you load to the div where you will show the video the gif.. After the call to the server side be complete, replace the gif with the right code.