播放非喜马拉雅声音

播放非喜马拉雅声音,需要同时设置 playlist、sounds,id 为 Number 类型的正整数(建议不要用奇怪的数字、浮点数等,虽然不一定会出错),playlist 的元素值必须能和 sounds 的 id 对应上,否则无法播放。

示例
import { XMplayer } from '@xmly-fem/web-jssdk'

// 以 id 为 sounds 对象的 key,字符串
const sounds = {
  "1": {
    "id": 1,
    "src": "http://aod.tx.xmcdn.com/group59/M09/3B/54/wKgLelzWfNbQR3a6ABz31eyJjKY954.m4a"
  },
  "2": {
    "id": 2,
    "src": "http://audio.xmcdn.com/group58/M06/6A/D9/wKgLglzZLrDhQ2V_ABbu1ZmT9ls470.m4a"
  },
  "3": {
    "id": 3,
    "src": "http://audio.xmcdn.com/group62/M04/2E/0F/wKgMZ10qFCqxgoFOABDIjrPCwpo708.m4a"
  }
}

// 创建播放器实例
const player = new XMplayer({
  // 自己的声音和喜马拉雅声音可以共存,在 sounds 里配置即可。
  playlist: [1, 2, 3, 182847535, 197491263, 183339305],
  sounds,
})

player.play()
© www.ximalaya.com lnc.ALL Rights Reserved 修订时间: 2019-08-02 13:59:11

results matching ""

    No results matching ""