1行でMP3プレイヤー起動!Yahoo! Media Playerでサクっと音楽配信。

Webページ上でMP3ファイルを再生(ストリーミング)する場合、下記の2つの方法がよく使われています。

  1. <embed>タグ、<object>タグで埋め込む。
  2. Flash製の音楽プレイヤーから読み込む。

1はXHTMLのみで記述できますが、ブラウザやプラグインに依存します。2はFlashプラグインがあれば再生できますが、音楽プレイヤーを用意する必要があります。

もっと簡単にMP3ファイルを再生させたいなら、「Yahoo! Media Player」がおすすめです。JavaScriptを1行読み込ませるだけで、MP3ファイルへのリンクが「再生ボタン」に変わります。

まず、MP3ファイルにリンクをはります。

<a href="xxxxx.mp3">リンク</a>

次に、</body>の直前に下記の一行を追加します。これで作業は完了です。

<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script>

リンクをクリックすると、再生が始まります。動作を確認したい方は、「Yahoo! Media Player」のページをご覧ください。

This entry was posted in ホームページ制作メモ. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

コメントをどうぞ

Your email is never published nor shared. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>