debug
This commit is contained in:
parent
b8b23f501c
commit
7a85ccf08d
@ -148,10 +148,10 @@ export default class MusicList {
|
|||||||
const sourceBuffer = mediaSource.addSourceBuffer(item.type)
|
const sourceBuffer = mediaSource.addSourceBuffer(item.type)
|
||||||
const arrayBufferLoader = async (index = 0) => {
|
const arrayBufferLoader = async (index = 0) => {
|
||||||
|
|
||||||
// 等待 item.arrayBufferChunks 不为空
|
//// 等待 item.arrayBufferChunks 不为空
|
||||||
while (item.arrayBufferChunks.length === 0) {
|
//while (item.arrayBufferChunks.length === 0) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 100))
|
// await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
}
|
//}
|
||||||
|
|
||||||
console.log('开始加载====================================')
|
console.log('开始加载====================================')
|
||||||
// 按照数据长度计算出分片应有数量, 如果数量不到且没有停止加载则一直读取
|
// 按照数据长度计算出分片应有数量, 如果数量不到且没有停止加载则一直读取
|
||||||
@ -174,6 +174,7 @@ export default class MusicList {
|
|||||||
} else {
|
} else {
|
||||||
while (item.arrayBufferChunks.length <= index) {
|
while (item.arrayBufferChunks.length <= index) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 100))
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
if (this.audio.paused || this.playing !== item) break // 播放停止或已经切歌则退出
|
||||||
}
|
}
|
||||||
const chunk = item.arrayBufferChunks[index] // 顺序取出一个arrayBuffer分片
|
const chunk = item.arrayBufferChunks[index] // 顺序取出一个arrayBuffer分片
|
||||||
if (this.audio.paused || this.playing !== item) break // 播放停止或已经切歌则退出
|
if (this.audio.paused || this.playing !== item) break // 播放停止或已经切歌则退出
|
||||||
|
Loading…
Reference in New Issue
Block a user