jwplayer将<object>转换为javascript </object>

时间:2015-02-19 20:00:50

标签: javascript html jwplayer

我正在尝试转换下面的代码:

<object data="http://www.primcast.com/jwplayer5/player.swf" type="application/x-shockwave-flash">
 <param name="quality" value="high">
 <param name="allowscriptaccess" value="always">
 <param name="allowfullscreen" value="true">
 <param name="flashvars" id="flashvars" value="
   &amp;file=MarinaFM2
   &amp;streamer=rtmp://38.96.175.16:1935/live
   &amp;autostart=false
   &amp;stretching=uniform
 ">
</object>

到此代码:

<head>
 <script src="jwplayer/jwplayer.js"></script>
</head>
<body>
 <div id="mediaplayer"></div>
 <script>
  jwplayer("mediaplayer").setup({
   file: "MarinaFM2",
   streamer: "rtmp://38.96.175.16:1935/live",
   autostart: false,
   stretching: "uniform"
  });
 </script>
</body>

但是我得到了#34;加载播放器时出错:找不到可播放的来源&#34;

任何人都可以尝试并给我解决方案谢谢。

2 个答案:

答案 0 :(得分:2)

此代码:

file: "MarinaFM2",
streamer: "rtmp://38.96.175.16:1935/live",

需要:

file: "rtmp://38.96.175.16:1935/live/MarinaFM2",

答案 1 :(得分:0)

这是一个完整的工作页面,您可以在localhost或Web服务器上运行:

<!DOCTYPE html>
<html>
<head>
    <title>RTMP Stream</title>
    <script src="http://p.jwpcdn.com/6/11/jwplayer.js" type="text/javascript"></script>
</head>
<body>
<div id="mediaplayer"></div>
 <script>
  jwplayer("mediaplayer").setup({
   file: "rtmp://38.96.175.16:1935/live/MarinaFM2",
   autostart: false,
   stretching: "uniform"
  });
 </script>
</body>
</html>