PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

 
Last updated: Fri, 29 Aug 2008

view this page in

SWFMovie->streamMP3

(No version information available, might be only in CVS)

SWFMovie->streamMP3MP3 ファイルをストリーム再生する

説明

SWFMovie
int streamMP3 ( mixed $mp3file [, float $skip ] )
警告

この関数は、 実験的 なものです。この関数の動作・ 名前・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 この関数は自己責任で使用してください。

指定した MP3 ファイル mp3file をストリーム再生します。

異常なデータに対する耐性は十分ではありません (最初の ID3 タグは読み飛ばしますが、その程度です)。

ムービーはそれほど賢くないので、mp3 ストリーム全体を含めるには 必要なだけの (曲の長さ * 一秒あたりのフレーム数) フレームを用意する必要があります。

パラメータ

mp3file

fopen() が返すファイルポインタ、 あるいはバイナリ文字列で指定した MP3 データ。

skip

スキップする秒数。

返り値

フレームの数を返します。

変更履歴

バージョン 説明
5.2.0 skip が追加されました。

例1 ストリーム再生の例

<?php
$m 
= new SWFMovie();
$m->setRate(12.0);
$m->streamMp3(file_get_contents("distortobass.mp3"));
// ご自身の MP3 を使用してください

// このファイルの長さは 11.85 秒で 12.0 fps です。つまり 142 フレームが必要です
$m->setFrames(142);

header('Content-type: application/x-shockwave-flash');
$m->output();
?>



 
Last updated: Fri, 29 Aug 2008
 
add a note add a note User Contributed Notes
SWFMovie->streamMP3
diana
08-Mar-2008 12:05
If you need to play an mp3 fully you need to do something like:
$len = $m->streamMp3(fopen("sound.mp3", "r"));
$m->setFrames($len);

This works only in Ming 0.4. I'm not 100% sure but it doesn't sound to work on Ming 0.3
boreckiwebs at gmail dot com
24-Aug-2006 06:54
if you want to control the sound use these functions like this:

<?php

$m
-> add(new SWFAction('
 stop(); // pauses the song
 goToAndStop(1); // stops the song, and goes back to the beginning
 play(); // plays the song from current position
'
));

?>

i hope this is helpful
boo at php dot net
21-Sep-2002 12:02
Don't forget to use fopen function in example above !

Use
$m->streamMp3(fopen("distortobass.mp3", "rb"));
instead of
$m->streamMp3("distortobass.mp3");

I hope this is useful for you :)
mued at muetdhiver dot org
18-May-2001 06:39
a nice feature to handle Id3tag is to get support from Unix mp3info command into a returning exec parsing

 
Last updated: Fri, 29 Aug 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites