Kode Javascript 4Shared Video Player


Contoh kode Javascript 4shared video player :

<div id="video"/>

<script type="text/javascript" src="https://static.4shared.com/flash/player/6.8/jwplayer.4min.js?ver=3942178347"></script>

<script type="text/javascript" src="https://static.4shared.com/js/clearEmptyVASTAds.4min.js?ver=1712767292"></script>

<script type="text/javascript">jwplayer.key="uzBbpYh+pgrOIlodl46+LloYU9avwUZ/lR5yAw==";</script>

<script type="text/javascript">
  var options_913127187 = {
    autostart: true,
    flashplayer: "https://static.4shared.com/flash/player/6.8/player.swf",
    html5player: "https://static.4shared.com/flash/player/6.8/jwplayer.html5.js",
    controlbar: "bottom",

    playlist: [{
      sources: [{
        file: "https://dc381.4shared.com/img/mmGhiv4dba/a04a0f85/dlink__2Fdownload_2FmmGhiv4dba_3Fsbsr_3D3995d5ebc153375ee56cdec19677b7e595c_26lgfp_3D1000_26dsid_3D22jbmq.433d1b6c78feacf649a4422d30fa2742/preview.mp4",
        label: "360p SD"
      }]
      
      ,tracks: [{
        file: "https://dc381.4shared.com/img/mmGhiv4dba/a04a0f85/dlink__2Fdownload_2FmmGhiv4dba_3Fsbsr_3D3995d5ebc153375ee56cdec19677b7e595c_26lgfp_3D1000/preview.vtt",
        kind: "thumbnails"
      }]
      
    }],

    width: 640,
    height: 400,
    wmode: "opaque",
    volume: "50",
    fallback: false,
    skin: "glow",
    advertising : {"client":"vast","skipoffset":5,"schedule":{"schedule1":{"offset":"pre","tag":"https://forshrd.com/vast.xml?key=0a76e88fb639f63190ba7a681cf1b541&zone=PRE_ROLL&dateTime=1449168128"}},"companion":null}
  };
  
    options_913127187.playlist[0]['image'] = 'https://dc381.4shared.com/img/mmGhiv4dba/14a4fa349c8/AltDetJegSigerErSandt';
    
    options_913127187['duration'] = '102.0';
    
    options_913127187['startparam'] = 'start';
    
    options_913127187['sharing'] = {"code":"<iframe src=\"http://www.4shared.com/web/embed/file/mmGhiv4dba\" frameborder=\"0\" scrolling=\"no\" width=\"470\" height=\"320\"></iframe>","link":"http://www.4shared.com/video/mmGhiv4dba/AltDetJegSigerErSandt.html"}
  
  options_913127187.primary = "flash";
  options_913127187.sign = 'e2c2c236a8de46332d43ae439f3975ec';
  options_913127187.vastMaxDeepToAdsCheck = '3';
  options_913127187.vastCheckAdsTimeout = '10';

  /**
    * @namespace
    */
  FlashPlayer = {};
  FlashPlayer.instances = FlashPlayer.instances || {};

  FlashPlayer.instances['video'] = {
    options : options_913127187,

    initInstance : function(options) {
      options = $.extend({
        forceStartPlay : false,
        onSetupError : null,
        onSuccess : function() { },
        onError : function() { }
      }, options);

      //options.onSuccess() - is called after player initialization
      //generally it receives an initialized instance of a player and should handle all further operations with it

      var currentInstance = FlashPlayer.instances['video'];

      if (currentInstance.playerObject) {
        options.onSuccess(currentInstance.playerObject); //already initialized
        return;
      }

      if (typeof clearEmptyVASTAds == "undefined" || false) {
        init(options);
      } else {
        var container = $('#video');
        container.addClass('loader');
        clearEmptyVASTAds({
          ads: currentInstance.options.advertising,
          maxDeep: currentInstance.options.vastMaxDeepToAdsCheck,
          callback: function() {
            container.removeClass('loader');
            init(options);
          },
          timeout: currentInstance.options.vastCheckAdsTimeout
        });
      }

      function init(options) {

        var container = $('#video');

        container.show();

        var player = jwplayer(container[0]).setup(options_913127187);

        player.onSetupError(function(error){
          if(error && error.fallback!==undefined && !error.fallback){
            if(options.onSetupError){ //user defined
              options.onSetupError(error)
            } else {
              var fallbackErrorElement = $('<div>').addClass("fakePlayer").appendTo(container);
              fallbackErrorElement.append($('<h2>').addClass('errorMessageBlock vid')
                  .html('Anda perlu memperbaharui Adobe Flash Player anda<br />' +
                  '<a href="http://www.adobe.com/support/flashplayer/downloads.html">Unduh dari Adobe</a>'));
            }
          }
        });

        player.onError(options.onError);

        if(options.forceStartPlay){
          player.play();
        }

        currentInstance.playerObject = player;

        options.onSuccess(player);

        player.onAdSkipped(function() {
          hideCompanion();
        });

        player.onAdComplete(function () {
          hideCompanion();
        });

        function hideCompanion() {
          $('#' + '').hide();
        }
      }
    }
  };
  
  $(function () {
    FlashPlayer.instances['video'].initInstance();
  });
  
</script>

Smoga bermanfaat.......!
Previous
Next Post »