logo       

RE: Embedding mp3 - Answered.: msg#00048

web.ming.general

Subject: RE: Embedding mp3 - Answered.

Just answered own question. Regarding mp3streaming.

Use fopen to read mp3 residing in root dir. And once again call in
through the object not the headers.

Using 3.0 ming and 4.3.4 php

Heres a very very basic script

The original mp3 is embedded and built within the newly created swf and
truly streamed. Just create proper stop, play , repeat objects to manage
the streaming swf.


<?php
$m = new SWFMovie();
$m->setRate(12.0);
$fp = fopen("Coldplay - Live - Daylight.mp3", "rb");

// 11.85 seconds at 12.0 fps = 142 frames
$m->setFrames(2500);
$m->streamMp3($fp);
$m->nextFrame();
$script = "play();";

$m->save("mp3stream.swf");
?>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4
,0,0,0" ID=objects WIDTH=468 HEIGHT=60>
<PARAM NAME=movie VALUE="mp3stream.swf">
<EMBED src="mp3stream.swf" WIDTH=468 HEIGHT=60
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_P
rod_Version=ShockwaveFlash">
</OBJECT>


See Seth Wilson's article for more info

PHP Architect
http://www.phparch.com/issue.php?mid=12

BCordingley

-----Original Message-----
From: ming-fun-bounces@xxxxxxxxxx [mailto:ming-fun-bounces@xxxxxxxxxx]
On Behalf Of Barry Cordingley
Sent: Tuesday, December 30, 2003 10:41 AM
To: 'Darren Cook'; ming-fun@xxxxxxxxxx
Subject: RE: [ming-fun] Embedding mp3

You are looking for the function "mp3stream" which by all accounts no
longer works with the newest compilation of php 4.3.3 and up.

This function "mp3stream" embeds the mp3 within the swf.

Has anyone been able to use mp3stream with 4..3.3 and newer php
compilations?

BCordingley


-----Original Message-----
From: ming-fun-bounces@xxxxxxxxxx [mailto:ming-fun-bounces@xxxxxxxxxx]
On Behalf Of Darren Cook
Sent: Tuesday, December 30, 2003 2:53 AM
To: ming-fun@xxxxxxxxxx
Subject: Re: [ming-fun] Embedding mp3

>>I'd like to embed a few mp3 files in a swf (as opposed
>> to streaming mp3).

Dave wrote:
> You can do it like this using the 0.3a CVS version.

Belated thanks for the replies. I've got Ming properly installed now and
managed to run the examples using PHP. The numbers don't appear by the
way
(I tried a few variations on _root.status=... but no luck yet).

More importantly to me, this example does not embed the mp3: the
produced
file is only 267 bytes, and if I delete the mp3 file after compiling it
fails to play anything.

In contrast when I do this with the Flash authoring tool, with the same
mp3
file, I get a 133Kb swf file. Is it possible to do the same with Ming?

Darren


> <?
> Ming_setScale(1.0);
> Ming_useSWFVersion(6);
>
> $mp3URL = 'distortobass.mp3';
>
> $f = new SWFFont("Arial.fdb");
>
> $m = new SWFMovie();
> $m->setDimension(20,20);
> $m->setBackground(0xff, 0xff, 0xff);
>
> $t = new SWFTextField(SWFTEXTFIELD_NOEDIT | SWFTEXTFIELD_NOSELECT );
> $t->setName("statusTxt");
> $t->setFont($f);
> $t->setColor(0x00, 0x00, 0x00);
> $t->setHeight(12);
> $t->addString('1');
> $xt = $m->add($t);
> $xt->setDepth(10);
> $xt->setName('status');
> $xt->moveTo(1,1);
>
> $m->add(new SWFAction("
> var loops = 1;
> sndClip1=new Sound();
> sndClip1.loadSound('$mp3URL',true);
> sndClip1.setVolume(100);
> sndClip1.start();
> sndClip1.onSoundComplete = function () {
> sndClip1.start();
> loops +=1;
> _root.statusTxt = loops;
> };
> "));
>
> $m->save("streammp3mx.swf",9);
>
> //header('Content-type: application/x-shockwave-flash');
> //$m->output(9); //Compression Level 0...9
> ?>


_______________________________________________
ming-fun mailing list
ming-fun@xxxxxxxxxx
http://www.opaque.net/mailman/listinfo/ming-fun

_______________________________________________
ming-fun mailing list
ming-fun@xxxxxxxxxx
http://www.opaque.net/mailman/listinfo/ming-fun


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise