Simple MP3 Player With Ming

Ming and ming again^^ I really interest with Ming Library on PHP. In this post I’ll share you simple MP3 player using Ming and PHP. Actually Ming Library doesn’t have sound event, but not impossible to make a simple MP3 player using Ming.

This is the complete script of simple mp3 player with Ming:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
  $m = new SWFMovie();
  $m->setDimension(400, 200);
  $m->setRate(12.0);
  $m->streamMp3(fopen("a.mp3", "rb"));
 
function rect($r, $g, $b, $signal)//buttonstyle
{
	$s = new SWFShape();
	if($signal==0)
	{
		$s->setRightFill($s->addFill(220, 220, 220));
	}
	else
	{
		$s->setRightFill($s->addFill(10, 10, 10));
	}
	$s->drawLine(180,0);
	$s->drawLine(0,180);
	$s->drawLine(-180,0);
	$s->drawLine(0,-180);
	if($signal==0)
	{
		$s->setRightFill($s->addFill(10, 10, 10));
	}
	else
	{
		$s->setRightFill($s->addFill(220, 220, 220));
	}
	$s->movepen(15,15);
	$s->drawLine(165,0);
	$s->drawLine(0,165);
	$s->drawLine(-165,0);
	$s->drawLine(0,-165);
	$s->setRightFill($s->addFill($r,$g,$b));//button surface
	$s->drawLine(150,0);
	$s->drawLine(0,150);
	$s->drawLine(-150,0);
	$s->drawLine(0,-150);
	return $s;
}
 
 
//start button
$b = new SWFButton();
$b->addShape(rect(0xff, 0, 0,0), SWFBUTTON_UP | SWFBUTTON_HIT);
$b->addShape(rect(0xff, 0xff, 0,1), SWFBUTTON_DOWN);
$b->addShape(rect(0xff, 0xff, 0,0), SWFBUTTON_OVER);
$b->addAction(new SWFAction('play();'),SWFBUTTON_MOUSEUP);
 
//stop button
$bb = new SWFButton();
$bb->addShape(rect(0xff, 0xff, 0,0), SWFBUTTON_UP | SWFBUTTON_HIT);
$bb->addShape(rect(0, 0xff, 0,1), SWFBUTTON_DOWN);
$bb->addShape(rect(0, 0xff, 0,0), SWFBUTTON_OVER);
$bb->addAction(new SWFAction("stop();"),SWFBUTTON_MOUSEUP);
 
//button location
$i = $m->add($b);
$i->moveTo(0,0);
$ii = $m->add($bb);
$ii->moveTo(200,0);
 
 
$m->setFrames(200);
 
$m->save("cobamp3.swf");
?>

And the result:

http://img102.imageshack.us/my.php?image=cobamp3zq8.swf

Nice…I’ll try to make more complex MP3 player with Ming..^^



Related Post:

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Blogroll Link Update