Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

播放时产生错误:No codec support for selected audio sources导致播放器状态异常 #1200

Open
reserveword opened this issue Nov 27, 2024 · 4 comments

Comments

@reserveword
Copy link
Contributor

播放时产生错误:No codec support for selected audio sources导致播放器状态异常,但是音乐还在正常播放,结果就是无法控制播放。如果继续点击播放的话就会先后错位播放同一音乐

@reserveword
Copy link
Contributor Author

js\player_thread.js文件中的Player.onloaderror(大概340行位置)除了删除howl对象之外还需要关闭对应howl,否则howl会继续播放音乐

@reserveword
Copy link
Contributor Author

图片
查看howler源码后得知,howler源码的load方法中会检查url所带的文件扩展名,如果扩展名不在白名单中就会报错误。但是之后程序还会启动howler,此时因为执行的不是howler.load方法,就能够正常播放音乐。

@reserveword
Copy link
Contributor Author

如果我们在定义Howl对象时指定了format属性,那么在这里就会设置内部的_format属性,从而跳过对url扩展名的判断。考虑到程序运行在chrome内核下,我们伪装成常见的mp3编码即可通过这一测试。

@reserveword
Copy link
Contributor Author

在做出以上修改后我在本地桌面app中测试发现已解决上述问题。

reserveword added a commit to reserveword/listen1_chrome_extension that referenced this issue Nov 27, 2024
1. 创建Howl对象时伪装文件格式为mp3,跳过Howl加载文件时检查url扩展名的功能
2. 删除失效Howl对象时不遍历整个播放列表,直接使用data.howl
3. 删除失效Howl对象时让Howl停止播放,避免出现无法控制的后台播放行为
listen1 pushed a commit that referenced this issue Dec 16, 2024
1. 创建Howl对象时伪装文件格式为mp3,跳过Howl加载文件时检查url扩展名的功能
2. 删除失效Howl对象时不遍历整个播放列表,直接使用data.howl
3. 删除失效Howl对象时让Howl停止播放,避免出现无法控制的后台播放行为
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant