Flowplayerを使ってみる(2)

この記事は2年以上前に書いたものです。
そのため情報が古い可能性があります。ご了承ください。m(_ _)m

で、mp3もストリーミング再生出来るようになるとか。

Streaming plugin:  audio

Flowplayerを使ってみる」で設定した環境に、追加設定してみる。

# DocumentRootは、/home/apache22/https。

% cd /home/apache22/https/flowplayer/
% wget 'http://flowplayer.org/releases/flowplayer.audio/flowplayer.audio-3.1.0.swf'
% cd example
% cp index.php index_mp3.php

% vi index_mp3.   ・・・id=”player”のAタグを↓に変更。

<div id="audio" style="display:block;width:750px;height:30px;"
     href="<?php echo urlencode($_SERVER["QUERY_STRING"]) ?>"></div>

あと、すぐ下のを↓に変更。

<script>
 // install flowplayer into container
 $f("audio", "../flowplayer-3.1.1.swf", {
 
 // fullscreen button not needed here
 plugins: {
       controls:{
               fullscreen: false,
               heightm: 30
       }
 },
 clip: {
         autoPlay: true,
         // optional: when playback starts close the first audio playback
         onBeforeBegin: function() {
                 $f("player").close();
         }
 }
 });
</script>

サンプルのmp3取得

% wget 'http://flowplayer.org/demos/plugins/fake_empire.mp3'

/flowplayer/example/index_mp3.php?/flowplayer/example/fake_empire.mp3
へアクセスして再生できればOK。

ウチの環境だと、↓こんな感じのURLになる。
ttps://qos.mine.nu/flowplayer/example/index_mp3.php?/flowplayer/example/fake_empire.mp3

mp4やflvと同じように、こちらもmp3にアクセスすると、勝手にFlowplayerで再生されるように、mod_rewriteの設定をイジる。

<IfModule mod_rewrite.c>
  RewriteEngine   on
  RewriteCond     %{REQUEST_URI}  .*(?:mp4|flv)$
  RewriteCond     %{HTTP_REFERER} !flowplayer-.*swf
  RewriteRule      (.*(?:mp4|flv)) /flowplayer/example/index.php?$1 [R]

  # mp3用に追加
  RewriteCond     %{REQUEST_URI}  .*(?:mp3)$
  RewriteCond     %{HTTP_REFERER} !flowplayer.audio-.*swf
  RewriteRule      (.*mp3)         /flowplayer/example/index_mp3.php?$1 [R]
</IfModule>
% sudo /usr/local/etc/rc.d/apache22 reload

/flowplayer/example/fake_empire.mp3
へアクセスして、Flowplayerで再生できればOK。

ウチの環境だと、↓こんな感じのURL。
ttps://qos.mine.nu/flowplayer/example/fake_empire.mp3

↓画面イメージ。

flowplayer_mp3

カテゴリー: ソフトウェア タグ: , , , , , パーマリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です