PDA

Просмотр полной версии : крутой Mp3 player


telit
04.07.2007, 21:49
Вот решил плеер сделать на as3

Хотелось бы на подобие медиа плеера 11 в виндозе.
Есть много компонентов, но собрать всё воедино не очень получается
П.с Самые большие проблемы вызывает ползунок прокрутки песни.
Может вместе составим плеер?!

etc
04.07.2007, 22:36
Зачем?

DarkLight
04.07.2007, 22:39
Ползунок прокрутки - самое примитивное. Sound.length + SoundChannel.position+немного логики

telit
04.07.2007, 22:44
package {
import flash.display.Sprite;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.events.Event;

public class ProgressBar2 extends Sprite {
private var _sound:Sound;
private var _channel:SoundChannel;

public function ProgressBar2( ) {
addEventListener(Event.ENTER_FRAME, onEnterFrame);
_sound = new Sound(new URLRequest("http://fla-md.com/play/song1.mp3"));
_channel = _sound.play( );
}

public function onEnterFrame(event:Event):void
{
var barWidth:int = 200;
var barHeight:int = 5;

var loaded:int = _sound.bytesLoaded;
var total:int = _sound.bytesTotal;

var length:int = _sound.length;
var position:int = _channel.position;

// Draw a background bar
graphics.clear( );
graphics.beginFill(0xFFFFFF);
graphics.drawRect(10, 10, barWidth, barHeight);
graphics.endFill( );

if(total > 0) {
// The percent of the sound that has loaded
var percentBuffered:Number = loaded / total;

// Draw a bar that represents the percent of
// the sound that has loaded
graphics.beginFill(0xCCCCCC);
graphics.drawRect(10, 10,
barWidth * percentBuffered,
barHeight);
graphics.endFill( );

// Correct the sound length calculation
length /= percentBuffered;

// The percent of the sound that has played
var percentPlayed:Number = position / length;

// Draw a bar that represents the percent of
// the sound that has played
graphics.beginFill(0x666666);
graphics.drawRect(10, 10,
barWidth * percentPlayed,
barHeight);
graphics.endFill( );
}
}
}
}

вот показывает текущую позицию песни

telit
05.07.2007, 00:08
http://www.torrentsmd.com/imagestorage/234339_90d.jpg
http://www.torrentsmd.com/imagestorage/234340_6ec.jpg

etc
05.07.2007, 00:39
Ну замечательно все, фотографии, все дела…
От юзверей форума вы чего хотите?
Чтобы щас все всё бросили и дружно начали писать плеер? Этого, в первую очередь, хотите вы, поэтому вам его и делать. К тому же, не вижу ничего полезного в клоне WMP, не говоря уже о том, что здесь нужно применять AIR и что производительность и работа со звуковыми файлами в AS3 в рамках такого проекта крайне плохая.

И потом, ну, допустим, плеер будет создан. Дальше что?

telit
05.07.2007, 00:52
Я, например предполагаю сделать бесплатный сайт для прослушивания мп3

etc
05.07.2007, 00:56
OMG, простите, какая практическая ценность сего действа?
Во всем должен быть смысл. Вот именно в этом — не вижу.

telit
05.07.2007, 13:58
Я не прошу Вас сделать плеер просто хочу услышать Ваши идеи
П.С плеер я сам делать буду...:cool: