(PHP 4 >= 4.3.3)
SWFMovie::streamMP3 — Streams a MP3 file
This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.
Streams the given MP3 file mp3file
.
This method is not very robust in dealing with oddities (can skip over an initial ID3 tag, but that's about it).
Note that the movie isn't smart enough to put enough frames in to contain the entire mp3 stream- you'll have to add (length of song * frames per second) frames to get the entire stream in.
mp3file
Can be a file pointer returned by fopen() or the MP3 data, as a binary string.
skip
Number of seconds to skip.
Return number of frames.
Version | Description |
---|---|
5.2.0 | skip added |
Example #1 Streaming example
<?php
$m = new SWFMovie();
$m->setRate(12.0);
$m->streamMp3(file_get_contents("distortobass.mp3"));
// use your own MP3
// The file is 11.85 seconds at 12.0 fps = 142 frames
$m->setFrames(142);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>