Skip to content

Commit

Permalink
修复播放部分歌曲时播放控制失灵的问题(#1200) (#1201)
Browse files Browse the repository at this point in the history
1. 创建Howl对象时伪装文件格式为mp3,跳过Howl加载文件时检查url扩展名的功能
2. 删除失效Howl对象时不遍历整个播放列表,直接使用data.howl
3. 删除失效Howl对象时让Howl停止播放,避免出现无法控制的后台播放行为
  • Loading branch information
reserveword authored Dec 16, 2024
1 parent c5cc22d commit 31276bf
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions js/player_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
if (!data.howl) {
data.howl = new Howl({
src: [self._media_uri_list[data.url || data.id]],
format: 'mp3', // bypass Howl checking url extension, issue #1200
volume: 1,
mute: self.muted,
html5: true, // Force to HTML5 so that the audio can stream in (best for large files).
Expand Down Expand Up @@ -335,12 +336,8 @@
});
self.currentAudio.disabled = true;
self.sendPlayingEvent('err');
for (let i = 0; i < self.playlist.length; i += 1) {
if (self.playlist[i].howl === self.currentHowl) {
self.playlist[i].howl = null;
}
}
self.currentHowl = null;
self.currentHowl.unload();
data.howl = null;
delete self._media_uri_list[data.id];
},
onplayerror(id, err) {
Expand Down

0 comments on commit 31276bf

Please sign in to comment.