diff --git a/assets/css/style.css b/assets/css/style.css index 4e2c862..feb4c52 100755 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -6234,14 +6234,19 @@ font-size: 0.7em; height: 100%; } .sc-player .sc-controls{ - background-image:url(../images/player.png); + background-image:url('../images/player.png'); height: 90px; width: 90px; content:''; } .sc-player.playing .sc-controls { + background-image:url('../images/player.png'); background-position: 90px; } +.sc-player.loadbg .sc-controls { + background:url('../images/preloader-bg.gif') center center no-repeat; + background-size: cover; +} .midia-category{ margin: 0 0 30px 10%; } diff --git a/assets/js/libs/soundcloud.js b/assets/js/libs/soundcloud.js index 37dc39d..ae1f6d5 100644 --- a/assets/js/libs/soundcloud.js +++ b/assets/js/libs/soundcloud.js @@ -105,6 +105,7 @@ }, // fired when widget starts playing current track (fired only once per track) onMediaStart : function(flashId, data) { + alert('start'); this._redispatch('onMediaStart', flashId, data); }, // fired when the track/playlist has finished playing @@ -113,6 +114,7 @@ }, // fired when widget starts playing current track (fired on every play, seek) onMediaPlay : function(flashId, data) { + alert('play') this._redispatch('onMediaPlay', flashId, data); }, // fired when track was paused @@ -582,6 +584,7 @@ }) // when the loaded track started to play .bind('scPlayer:onMediaPlay', function(event) { + alert('ahoy'); clearInterval(positionPoll); positionPoll = setInterval(function() { var duration = audioEngine.getDuration(), diff --git a/assets/js/main.js b/assets/js/main.js index 2248ce7..07add54 100755 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -650,4 +650,21 @@ twitterFetcher.fetch(config1); $(document).on('closed.fndtn.reveal', '[data-reveal]', function () { $.scPlayer.stopAll(); }); + $(document).on('onPlayerPlay.scPlayer', function(e){ + $(e.target).addClass('loadbg'); + var check_timer = function() { + var timer = $(e.target).find('.sc-scrubber .sc-time-span .sc-buffer').css('width'); + var timer = timer.split('.'); + console.log(timer[0]); + if(parseInt(timer[0]) >= 1){ + $(e.target).removeClass('loadbg'); + } + else{ + setTimeout(function(){ + check_timer(); + },1) + } + } + check_timer(); + }); });