Показать сообщение отдельно
Старый 09.12.2009, 17:48
Zero108 вне форума Посмотреть профиль Отправить личное сообщение для Zero108 Найти все сообщения от Zero108
  № 1  
Ответить с цитированием
Zero108
 
Аватар для Zero108

Регистрация: Dec 2009
Сообщений: 4
Question Проигрывание mp3 в реальном времени

Есть на сервере index.swf, который, среди прочего великолепия, умеет проигрывать в реальном времени mp3 файлы. Файл (один) выбирается случайным образом из списка и проигрывается по кругу. Как изменить следующий код, чтобы файлы проигрывались по кругу один за другим в реальном времени?

Код AS1/AS2:
///////////////MUSIC PLAYER ////////////////////////////////
//we create the array thay will handle the mp3's
var song:Array = new Array();
//The random songs
song[0] = "cms_mp3/ran_jazzmatazz.mp3";
song[1] = "cms_mp3/scottwills_summerjazz.mp3";
song[2] = "cms_mp3/flar_neon.mp3";
song[3] = "cms_mp3/solidbeats_simmerdown.mp3";
//the i var will check the number of songs to random
i = song.length;
//all the song are mixed in a random order
RandomSong = Math.floor(Math.random()*i);
//We set the variables to work with 
MinimumVolumen = 0;
MaximumVolumen = 100;
step = 1;
fade = 0;
StartAlphaEqualizer = MaximumVolumen;
EndAlphaEqualizer = 0;
//Buffertime before to start playing (5 seconds)
music._soundbuftime = 5;
//We create a new sound class
music = new Sound();
// We load the random Songs in streaming
music.loadSound(song[RandomSong], true);
// We put the vol at zero at the begining
music.setVolume(0);
//When the music is finish we play again to create a loop 
music.onSoundComplete = function() {
	trace("Song is playing again");
	this.start();
};
//FADE IN OUT
FadeInandOut = function () {
	onEnterFrame = function () {
		// We check if the vol is on , so we make a fade out
		if (fade == 1) {
			MinimumVolumen = MinimumVolumen-step;
			if (MinimumVolumen<0) {
				MinimumVolumen = 0;
			}
			music.setVolume(MinimumVolumen);
			// If the song is off, we make a fade in
		} else {
			MinimumVolumen = MinimumVolumen+step;
			if (MinimumVolumen>MaximumVolumen) {
				MinimumVolumen = MaximumVolumen;
			}
			music.setVolume(MinimumVolumen);
		}
	};
};
//We call the function
FadeInandOut();


Последний раз редактировалось iNils; 09.12.2009 в 18:08.