您当前的位置: 首页 > 知识百科 > 微信小程序怎么播放本地的音乐?

微信小程序怎么播放本地的音乐?

时间:2023-07-01 14:05 阅读数:19 人阅读 分类:知识百科

  微信小程序怎么播放本地的音乐?怎么用微信小程序播放本地音乐呢?下面小编就来带着大家一起看一看微信小程序怎么播放本地的音乐?

  一主体代码

  ${music.title}

  歌手:${music.artistName}

  加载歌词……

  play

  mute

  max volume

  Update Required

  To play the media you will need to either update your browser to a recent version or update your Flash plugin.

  二、静态资源引入

  三、自定义js

  $("#jquery_jplayer_1").jPlayer({

  ready: function () {

  ---------------------------------- >这里自己实现加载歌词放入id=lrc_content中

  $(this).jPlayer("setMedia", {

  mp3: url

  }).jPlayer("play").jPlayer("repeat")

  },

  timeupdate: function(event) {

  if(event.jPlayer.status.currentTime==0){

  time = "";

  }else {

  time = event.jPlayer.status.currentTime;

  }

  },

  play: function(event) {

  //点击开始方法调用lrc.start歌词方法 返回时间time

  if($('#lrc_content').val()!==""){

  $.lrc.start($('#lrc_content').val(),function(){

  return time;

  });

  }else{

  $(".content").html("没有字幕");

  }

  },

  ended: function(event) {

  $("#lrc_list").removeAttr("style").html("

  歌曲播放完毕!

  ");

  },

  swfPath: "/resource/music/js/jquery.jplayer.swf", //播放用flash所在的相对路径

  supplied: "mp3",

  solution: "html, flash", //支持的页面

  wmode: "window",

  remainingDuration: true,

  toggleDuration: true,

  useStateClassSkin: true,

  autoBlur: false,

  smoothPlayBar: true,

  keyEnabled: true

  总体来说实现和别人说的方式答题一致,但是尤其得注意兼容问题。

  以上就是小编为大家整理的关于微信小程序怎么播放本地的音乐的内容。更多更精彩的内容请持续关注小程序商店。

  相关阅读:

       微信小程序录音授权关键代码

       微信小程序下拉框开发代码

       申请小程序商店教程