本文介绍了在jw播放器中使用动态smil文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用JW Player 6制作在线流播放器.

I'm trying to make a online stream player with JW Player 6.

如果我使用所有质量版本的流创建一个smil文件,并使用下面的代码,它将运行良好:

If I create a smil file with all the quality version of streams and use the code below it works fine:

<script>
    jwplayer("myElement").setup({
        playlist: [{
            sources: [{
                file: "/player/smil.asp"
        }]
      }],
      type: 'rtmp'
    });
</script>

smil文件:

<smil>
  <head>
    <meta base="rtmp://host/app" />
  </head>
  <body>
    <switch>
      <video src="quality1" system-bitrate="720" />
      <video src="quality2" system-bitrate="360" />
    </switch>
  </body>
</smil>

我想根据用户的质量选择动态创建smil文件. (即:丢弃高于720的比特率)

I want to create the smil file on the fly based on user's quality selections. (ie: discard bitrates higher than 720)

我使用asp文件动态创建了smil文件,但是没有用:

I used an asp file to create smil file dynamically but it didnt work:

file: "/player/smil.asp"

当然我在asp文件中将标头类型设置为 application/octet-stream ,但没有解决问题.

of course I set header type to application/octet-stream in the asp file but didnt solve the problem.

我还尝试使用smil扩展名保存相同的asp文件,然后在IIS设置中为smil文件设置asp处理程序.当我在浏览器中调用时,它可以完美工作,但jw Player会显示相同的错误.

I also tried saving same asp file with smil extension and than set the asp handler for smil files in IIS setting. it works perfectly when I call in browser, but jw player shows same error.

有什么建议吗?

谢谢.

推荐答案

定义源类型可以解决此问题.

Defining type of source solves the problem.

sources: [{
    file: "/player/smil.asp",
    type: "rtmp"
}]

感谢伊桑(Ethan)的耐心.

Thanks to Ethan for his patience.

这篇关于在jw播放器中使用动态smil文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 14:24