Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > JavaScript: Общие вопросы > Помогите в Sound Manager 2! пожалуйста! очень нужн


Автор: adrian67 10.3.2012, 04:54
не могу сделать время и подключить Плейлист((

<!-- - - Sound Manager 2 - - -->
<script src="javascripts/soundmanager2.js"></script>
<script>
soundManager.flashVersion = 8,9,10;
soundManager.url = 'javascripts/soundmanager2.swf';
soundManager.useFlashBlock = false;
soundManager.debugMode = false;
soundManager.waitForWindowLoad = true;
soundManager.useHTML5Audio = true;
soundManager.onready(function() {
var mySound = soundManager.createSound({
id: 'podcast-player',
url: 'http://cs4527.vk.com/u56363091/audio/94647e45ac57.mp3',
autoLoad: false,
autoPlay: false,
volume: 30,
onload: function() {

$('#podcast-play_pause').removeClass('podcast-play').addClass('podcast-pause');
},
onpause: function() {
$('#podcast-play_pause').removeClass('podcast-pause').addClass('podcast-play');
},
whileloading: function() {
document.getElementById("podcast-progress-load").style.width=(((this.bytesLoaded/this.bytesTotal)*100)+'%');
},
whileplaying: function() {

// Конвертация времени
milliSecs = this.position
msSecs = (1000)
msMins = (msSecs * 60)
msHours = (msMins * 60)
numHours = Math.floor(milliSecs/msHours)
numMins = Math.floor((milliSecs - (numHours * msHours)) / msMins)
numSecs = Math.floor((milliSecs - (numHours * msHours) - (numMins * msMins))/ msSecs)
if (numSecs < 10){
numSecs = "0" + numSecs
if (numSecs > 10)
numSecs = "0" + numSecs    
}

resultString = /*numHours + ":" + */numMins + ":" + numSecs 
$('#podcast-current-time').html(resultString);

milliSecs = this.position
msSecs = (1000)
msMins = (msSecs * 60)
msHours = (msMins * 60)
numHours = Math.floor(milliSecs/msHours)
numMins = Math.floor((milliSecs - (numHours * msHours)) / msMins)
numSecs = Math.floor((milliSecs - (numHours * msHours) - (numMins * msMins))/ msSecs)
if (numSecs < 10){
numSecs = "0" + numSecs
if (numSecs > 10)
numSecs = "0" + numSecs    
}
resultString = numMins + ":" + numSecs 
$('#podcast-duration').html(resultString);

// Значения для прогресс-бара 
$("#podcast-progress-bar").slider("option", "value", this.position);
$("#podcast-progress-bar").slider("option", "max", this.durationEstimate);
},
});

// Play/Pause
$('#podcast-play_pause').click(function () {
soundManager.togglePause('podcast-player');
});


// Громкость
$("#podcast-volume-bar").slider({
range: "min",
value: 30,
min: 0,
max: 100,
step: 1,
animate: true,
slide: function(event, ui) {
soundManager.getSoundById('podcast-player').setVolume(ui.value);
}
});
// Включение и выключение громкости
$('#podcast-mute').click(function(){
soundManager.getSoundById('podcast-player').setVolume(0);
$("#podcast-volume-bar").slider('value', 0);
return false;
});
$('#podcast-unmute').click(function(){
soundManager.getSoundById('podcast-player').setVolume(100);
$("#podcast-volume-bar").slider('value', 100);
return false;
});

// Прогресс
$("#podcast-progress-bar").slider({ 
range: "min",
min: 0,
step: 1,
animate: true,
slide: function(event,ui) {
soundManager.getSoundById('podcast-player').setPosition(ui.value);
}
});
});    
</script>
<!-- - - - - - - - - - - -->

<!-- - - - Playlist - - - -->
<script>
function initMenu() {
$('#podcast-list .podcast-list-item-more').hide();
//$('#podcast-list .podcast-list-item-more:first').show();
$('#podcast-list article a').click(
function() {
var checkElement = $(this).next();
if((checkElement.is('.podcast-list-item-more')) && (checkElement.is(':visible'))) {
return false;
}
if((checkElement.is('.podcast-list-item-more')) && (!checkElement.is(':visible'))) {
$('#podcast-list .podcast-list-item-more:visible').slideUp('normal');

$('#podcast-list article a').slideDown('fast'); //fix
$(this).slideUp('fast'); //fix

checkElement.slideDown('fast');
return false;
}
}
);
}
$(document).ready(function() {initMenu();});
</script>
<!-- - - - - - - - - - - -->

<!-- - - - Nano Scroller - - - -->
<script src="jquery.nanoscroller.js"></script>
<script>
$(function(){
$('.nano').nanoScroller();
});
</script>
<!-- - - - - - - - - - - - - - -->

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)