jPlayerのデフォルト音声プレーヤー。
音楽素材:コーヒータイム
音声のメディアフォーマットは、mp3, m4a, ogaを指定。ページロード時に自動的に再生が始まります。
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <style type="text/css">li { margin:0; }</style> <!-- CSS --> <link rel="stylesheet" type="text/css" href="/content/lib/jquery/jplayer/skin/blue.monday/jplayer.blue.monday.css" /> <!-- JS --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" ></script> <script type="text/javascript" src="/content/lib/jquery/jplayer/jquery.jplayer.min.js" ></script> <script type="text/javascript"> $(function(){ $("#audio_player").jPlayer({ /* イベントハンドラ */ ready: function(){ /* 再生するメディアの定義 */ $(this).jPlayer("setMedia", { mp3: "/content/media/audio/Q701.mp3", /* mp3 */ m4a: "/content/media/audio/Q701.m4a", /* m4a (AAC) */ oga: "/content/media/audio/Q701.ogg" /* oga */ }).jPlayer("play"); /* 自動再生 */ }, /* プレロード(デフォルトは'metadata'、プレロードする場合は'auto') */ preload: "auto", /* 音量(デフォルトは0.8、指定可能な値の範囲は0~1) */ volume: 0.5, /* ミュートの有無(デフォルトはfalse)*/ muted: false, /* 背景色*/ backgroundColor: "#ff6699", /* エラーアラート表示の有無(デフォルトはfalse) */ errorAlerts:false, /* 警告アラート表示の有無(デフォルトはfalse) */ warningAlerts:false, /* 最後まで再生された時 */ ended: function (event) { /* また再生する */ //$(this).jPlayer("play"); }, /* Jplayer.swfのパス */ swfPath: "/content/lib/jquery/jplayer/", /* ソリューションの優先度(デフォルトは\"html, flash\") */ solution: 'html, flash', /* フォーマット(デフォルトはmp3、カンマ区切りで複数指定可、優先度は左が高)*/ /* 指定可能なフォーマットは、mp3, m4a, m4v, oga, ogv, wav, webma, webmv */ /* 音声ならmp3 or m4a、動画ならm4v */ supplied: "mp3, m4a, oga", wmode: "window" }) .bind($.jPlayer.event.play, function() { $(this).jPlayer("pauseOthers"); }); }); </script> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <div id="wrap"> <h1>設置サンプル</h1> <p>jPlayerのデフォルト音声プレーヤー。</p> <p>参照:<a href='http://www.jplayer.org' target='_blank'>jPlayer 2.1.0</a></p> <p>音楽素材:<a href='http://maiise.dtiblog.com/blog-entry-2346.html'>コーヒータイム</a></p> <p>音声のメディアフォーマットは、mp3, m4a, ogaを指定。ページロード時に自動的に再生が始まります。</p> <!-- CODE --> <div id="audio_player" class="jp-jplayer"></div> <div id="jp_container_1" class="jp-audio"> <div class="jp-type-single"> <div class="jp-gui jp-interface"> <ul class="jp-controls"> <li><a href="#" class="jp-play" tabindex="1">play</a></li> <li><a href="#" class="jp-pause" tabindex="1">pause</a></li> <li><a href="#" class="jp-stop" tabindex="1">stop</a></li> <li><a href="#" class="jp-mute" tabindex="1" title="mute">mute</a></li> <li><a href="#" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li> <li><a href="#" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li> </ul> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"></div> </div> </div> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> <div class="jp-time-holder"> <div class="jp-current-time"></div> <div class="jp-duration"></div> <ul class="jp-toggles"> <li><a href="#" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li> <li><a href="#" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li> </ul> </div> </div> <div class="jp-title"> <ul> <li><a href='http://maiise.dtiblog.com/blog-entry-2346.html'>ドラムの音</a> - コーヒータイム</li> </ul> </div> <div class="jp-no-solution"> <span>Update Required</span> To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>. </div> </div> </div> <!-- / CODE --> </div> </body> </html>