如何使用Jplayer播放多个mp3文件

How to play multiple mp3 files with Jplayer?

本文关键字:mp3 文件 播放 何使用 Jplayer      更新时间:2023-09-26

在这里,我使用的是Jplayer,一个用于mp3播放器的开源插件。

myPlaylist.add({
  title:"Tempered Song",
  artist:"Miaow",
  mp3:"http://www.jplayer.org/audio/mp3/Miaow-01-Tempered-song.mp3",
});

但是假设如果我three包含三种不同音乐的锚标签。

<a href="#">This is song 1</a>
<a href="#">This is song 2</a>
<a href="#">This is song 3</a>

显然,我无法将音乐URL放入href。单击后,它将开始自动下载或打开窗口媒体播放器。

那么,如何将三个不同的音乐源文件放入此jquery脚本中?或者你用什么来播放 mp3 文件而不是使用锚标签?

myPlaylist.add({
      title:"<Song name>",
      artist:"<singer name>",
      mp3:"<MP3 URL of three different song>",
    });

我想将这三个不同的mp3文件播放到一个播放器中,但感到困惑。我无法在谷歌中找到jplayer倾向于使用不同的多个mp3文件与jplayer。请帮忙怎么做?

帮助,将不胜感激!!

很容易,无需使用 jquery attr 进行锚定。

<a href="#" music-url="songs_music_url">This is song 1</a>

在jquery中:

myPlaylist.add({
  title:"<Song name>",
  artist:"<singer name>",
  mp3:$('a').attr('music-url'),
});