アプリ版:「スタンプのみでお礼する」機能のリリースについて

音楽再生用jQueryプラグイン「jplayer」で自動再生しない方法を教えてください。
http://www.happyworm.com/jquery/jplayer/
こちらのプラグインを利用しようと検討中ですが、 http://www.happyworm.com/jquery/jplayer/latest/d … どのデモを見ても、アクセス後すぐに音楽がなり出すサンプルばかりで困っています。
可能であれば、ページを開いた時には音楽が突然ならないように制御したいと思っています。
JavaScriptの知識が足りないため、どこにどのようなコードを埋め込めばそのようにできるかがわからないので、もし分かる方がいらっしゃいましたら教えていただけますでしょうか。
よろしくお願いいたします。

A 回答 (2件)

ドキュメント


http://www.happyworm.com/jquery/jplayer/latest/d …
を見ると、jPlayerオブジェクトの再生開始と再生停止のメソッドは
それぞれ、$(id).jPlayer( "play" )、$(id).jPlayer( "stop" )ですね。

これを使えばよいだけかと、

Example #1:の例に摘要するとして、
$(document).ready(function() {
  $("#jpId").jPlayer( {
   ready: function () {
    this.element.jPlayer("setFile", "../mp3/elvis.mp3"); // Defines the mp3
    this.element.jPlayer("stop")
   }
  });
});

Example #3:の例に摘要するとして、
$(function() { // executed when $(document).ready()
  $("#jpId").jPlayer( {
   ready: function () {
    this.element.jPlayer("setFile", "http://www.myDomain.com/mp3/elvis.mp3").jPlayer( … // Not Auto-Plays the file
   },
   swfPath: "jPlayer/js"
  });
});
    • good
    • 0

1行が長かったので、肝心の部分が...になってしまった。


Example #3:の例は↓です。

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/ …
</script>
<script type="text/javascript" src="js/jquery.jplayer.min.js">
</script>
<script type="text/javascript">
$(function() { // executed when $(document).ready()
  $("#jpId").jPlayer( {
   ready: function () {
    this.element.jPlayer("setFile",
     "http://www.myDomain.com/mp3/elvis.mp3").jPlayer( …
   },
   swfPath: "jPlayer/js"
  });
});
</script>
</head>
<body>
<div id="jpId"></div>
</body>
    • good
    • 0
この回答へのお礼

ありがとうございます!助かりました。

お礼日時:2010/10/01 11:08

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!