小程序是否支持多个本地音频顺序播放
发布于 6 年前 作者 juan35 6171 次浏览 来自 问答

你想反馈一个 Bug 还是 提一个需求?

如果是 Bug:Bug

* Bug 表现是什么?预期表现是什么?

* 如何复现?

//播放声音

play: function () {

     wx.getSavedFileList({

      success: function (res) {

        var LEN = res.fileList.length

        if (LEN > 0) {

          console.log(‘number of files:’+LEN)

          for (var i = 0; i < LEN; i++) {

            InnerAudioContext.src = res.fileList[i].filePath;

            InnerAudioContext.play();

            console.log(‘File’ + i + " :  " + InnerAudioContext.src)

          }

        }

        InnerAudioContext.onPlay(() => {

          console.log(‘onPlay()’);

        });

        InnerAudioContext.onError((res) => {

          console.log(res.errMsg)

          console.log(res.errCode)

        });

      }

    })

}

* 提供一个最简复现 Demo

number of files:2

index.js? [sm]:94 File0 :  http://store/wx22fa435613e4a846.o6zAJsww-VE9mPPuvHzlEPwDQOm8.a1e62f616556cf7a33124d5db0cb211b.durationTime=10003.mp3

index.js? [sm]:94 File1 :  http://store/wx22fa435613e4a846.o6zAJsww-VE9mPPuvHzlEPwDQOm8.c209cfdbf56e82e60e2ffef07fc0b37b.durationTime=10002.mp3

index.js? [sm]:105 onPlay()

能读取到所有 音频文件名,但 只有最后一个音频文件播放出来

如果是需求:

* 你希望有什么能力?

* 你需要这个能力的场景是 ?

1 回复

我也遇到了相似的场景,亲如果解决了,请告诉我下,谢谢

回到顶部