Amplitude.js - 直播
Amplitude.js - Live Stream
我正在尝试使用实时流音频并完全按照本教程中的说明进行操作,但它不起作用。 AmplitudeJS for Live Stream HTML5 Audio 我有一个空白页面,控制台中没有显示任何错误。我发现一个 "contradiction",在教程中,Amplitude 没有像文档中说的那样被初始化:
To initialize Amplitude.js, you must call the Amplitude.init() method and pass in an object that contains an array of songs and settings
我查找了指定如何使用直播流的文档部分,但没有找到。
我会更新那个教程的!要进行直播,您必须设置流媒体服务。然后在初始化 Amplitude.js 时,您的歌曲数组将必须包含一个 'live' 标志为 'true' 的歌曲对象。参见:https://521dimensions.com/open-source/amplitudejs/docs#song-objects
初始化示例如下:
Amplitude.init({
"songs": [
{
"name": "Station Name",
"url": "https://yourstreamingservice.com/something-that-returns-properly-encoded-audio",
"station_art_url": "/station/art/url.jpg",
"genre": "country"
"live": true
}
]
});
当 live 标志设置为 true 时,pause 会切断流,因此它不会保存到本地内存,并且会在实际流所在的位置恢复,而不是用户设置为暂停的位置。
希望对您有所帮助!
我正在尝试使用实时流音频并完全按照本教程中的说明进行操作,但它不起作用。 AmplitudeJS for Live Stream HTML5 Audio 我有一个空白页面,控制台中没有显示任何错误。我发现一个 "contradiction",在教程中,Amplitude 没有像文档中说的那样被初始化:
To initialize Amplitude.js, you must call the Amplitude.init() method and pass in an object that contains an array of songs and settings
我查找了指定如何使用直播流的文档部分,但没有找到。
我会更新那个教程的!要进行直播,您必须设置流媒体服务。然后在初始化 Amplitude.js 时,您的歌曲数组将必须包含一个 'live' 标志为 'true' 的歌曲对象。参见:https://521dimensions.com/open-source/amplitudejs/docs#song-objects
初始化示例如下:
Amplitude.init({
"songs": [
{
"name": "Station Name",
"url": "https://yourstreamingservice.com/something-that-returns-properly-encoded-audio",
"station_art_url": "/station/art/url.jpg",
"genre": "country"
"live": true
}
]
});
当 live 标志设置为 true 时,pause 会切断流,因此它不会保存到本地内存,并且会在实际流所在的位置恢复,而不是用户设置为暂停的位置。
希望对您有所帮助!