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

vue 无法获取到 decoder #19

Closed
Hunlongyu opened this issue Dec 20, 2019 · 15 comments
Closed

vue 无法获取到 decoder #19

Hunlongyu opened this issue Dec 20, 2019 · 15 comments

Comments

@Hunlongyu
Copy link

Hunlongyu commented Dec 20, 2019

Expected behaviour

vue 中如何引入 flvplayer-decoder-baseline.js 文件啊?

Actual behaviour

Steps to reproduce

Environment

  • Browser: chrome
  • Version: 79.0.3945.88
  • Operating System: win10
  • Version: 1909

Console errors (if any)

Snipaste_2019-12-20_15-28-54.png
carbon.png
carbon

Link to where the bug is happening

carbon (1)
carbon (1).png

@zhw2590582
Copy link
Owner

zhw2590582 commented Dec 20, 2019

flvplayer-decoder-baseline.js是一个单独文件,Vue是不会把他打包的,你可以相对引用或者绝对引用, 直接decoder填路径就好,注意decoder是从根目录开始查找的,不是你写的那个JS文件开始查找。

new FlvPlayer({
   decoder: 'flvplayer-decoder-baseline.js',
})

@Hunlongyu
Copy link
Author

Hunlongyu commented Dec 20, 2019

carbon (2)
Snipaste

我设置 hasAudio: false
但还是报音频错误

@zhw2590582
Copy link
Owner

最后有画面输出么,我这个库,音频只支持aac

@Hunlongyu
Copy link
Author

最后有画面输出么,我这个库,音频只支持aac

没有输出视频画面
bilibili 的 flv.js 的 hasAudio: true 时, 也报错.
但是 flv.js 设置为 hasAudio: false 时,不会报错.

FlvPlayer 的 hasAudio: false 时,报错

@zhw2590582
Copy link
Owner

有道理,我后面再改下这个逻辑

@Hunlongyu
Copy link
Author

话说这个 decoder 的引入方式,可以改变一下吗?
类似这种:
carbon (4)

@zhw2590582
Copy link
Owner

不能,因为decoder 不是一个普通模块,而是一个worker

@AhJane
Copy link

AhJane commented Jan 7, 2020

也遇到在vue里引入不了decoder的问题,各种路径都试过了,不填使用默认配置也不行。请问作者大大没有其他的引入方式了吗?😂😂

@zhw2590582
Copy link
Owner

@AhJane 假如你找不到相对路径,那可以直接写绝对路径

@AhJane
Copy link

AhJane commented Jan 7, 2020

@AhJane 假如你找不到相对路径,那可以直接写绝对路径

相对路径、绝对路径都找不到呀😂

@zhw2590582
Copy link
Owner

@AhJane 截图看看报什么错

@AhJane
Copy link

AhJane commented Jan 7, 2020

@zhw2590582 跟开这个issue的兄弟一样呢
image

@AhJane
Copy link

AhJane commented Jan 7, 2020

@zhw2590582 各种路径组合我都试过了,仍然报这个错呢😭

@zhw2590582
Copy link
Owner

zhw2590582 commented Jan 7, 2020

@AhJane 假如你是用vue-cli生成的项目,你可以把 flvplayer-decoder-baseline.js 放到你的public目录,然后直接这样,因为webpack改写了静态资源的访问路径,所以导致很容易找不到相对路径。

var flv = new FlvPlayer({
  container: ".flvplayer-app",
  url: "https://flvplayer.js.org/assets/video/weathering-with-you.flv",
  decoder: "flvplayer-decoder-baseline.js",
});

@AhJane
Copy link

AhJane commented Jan 7, 2020

@zhw2590582 按照你说的这种方法可以找到了,谢谢

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

3 participants