【问题标题】:Read audio file from php从 php 读取音频文件
【发布时间】:2014-09-20 18:53:35
【问题描述】:

我在 jw 播放器中使用此代码播放音频。

<script type='text/javascript'>
jwplayer('player_1234').setup({
   file: 'http://localhost/media.php?media_id=1822',
   type: 'm4a', 
   width: '100%',
   plugins: {},
   aspectratio: '16:9',
  fallback: 'false',
   primary: jwplayer.utils.isChrome() ? "html5" : "html5"
   });
</script>

这里,media.php 文件使用readfile() 返回正确的内容类型audio header()

Media.php 直接在浏览器中输入效果很好。

但是 jw 播放器在页面加载时给出此错误消息 “无法读取未定义的属性 'sources'”。我该如何解决这个错误?

【问题讨论】:

  • 这称为传播。问题是文件没有被流式传输,但必须先下载。
  • @M1K1O 这个怎么解决?
  • 请提供一个链接到您正在运行它的位置。
  • @Ethan JWPlayer 你能猜出可能是什么问题吗?在这种情况下,视频可以正常播放,但音频不能。

标签: javascript php jquery jwplayer


【解决方案1】:

当类型更改为 mp4 而不是 m4a 时有效

<script type='text/javascript'>
jwplayer('player_1234').setup({
   file: 'http://localhost/media.php?media_id=1822',
   type: 'mp4', 
   width: '100%',
   plugins: {},
   aspectratio: '16:9',
  fallback: 'false',
   primary: jwplayer.utils.isChrome() ? "html5" : "html5"
   });
</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-19
    • 1970-01-01
    • 2013-04-09
    • 1970-01-01
    相关资源
    最近更新 更多