javascript 如何安装 JW Player 7.1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32657614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install JW Player 7.1
提问by user2948033
I downloaded the version "JW Player 7 (Self-Hosted)".
我下载了“JW Player 7(自托管)”版本。
Then I copied the uncompressed folder jwplayer-7.1.0 to /home/vmg/public_html/. It contains the following files and folders:
然后我将未压缩的文件夹 jwplayer-7.1.0 复制到 /home/vmg/public_html/。它包含以下文件和文件夹:
- 1.js
- jwplayer.flash.swf
- jwplayer.js
- provider.cast.js
- provider.shaka.js
- provider.youtube.js
- skins/
- 1.js
- jwplayer.flash.swf
- jwplayer.js
- 提供者.cast.js
- 提供者.shaka.js
- 提供者.youtube.js
- 皮肤/
I've saved a video (video.mp4) and a image (image.jpg) in the folder jwplayer-7.1.0. Next I edited the index.html contained in the folder public_html/:
我在文件夹 jwplayer-7.1.0 中保存了一个视频 (video.mp4) 和一个图像 (image.jpg)。接下来,我编辑了文件夹 public_html/ 中包含的 index.html:
<!DOCTYPE html>
<html>
<head>
<!-- JS jwplayer 6.8 -->
<script type="text/javascript" src="jwplayer-7.1.0/jwplayer.js"></script>
<!-- JWplayer Licence - put your licence here -->
<script type="text/javascript">jwplayer.key="CKjOe06GxAOe3Dj9NaWPCQKtqvqQdyFV8z9wsg==";</script>
</head>
<body>
<div id="video">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("video");
playerInstance.setup({
file: "jwplayer-7.1.0/video.mp4",
image: "jwplayer-7.1.0/image.jpg",
width: 384,
height: 216,
title: 'Basic Video Embed',
description: 'A video with a basic title and description!'
});
</script>
</body>
</html>
I open this file on Chrome and it works.
我在 Chrome 上打开这个文件,它工作正常。
But I want to work with streaming content and I saw this link http://doc.streamroot.io/doc/latest/en/Front_end_player_configuration/Players_Instructions/JWplayer.htmlfor a previous version of this player. It seems to work with MPEG-DASH manifests and HLS playlists.
但我想处理流媒体内容,我看到了此播放器以前版本的链接http://doc.streamroot.io/doc/latest/en/Front_end_player_configuration/Players_Instructions/JWplayer.html。它似乎适用于 MPEG-DASH 清单和 HLS 播放列表。
With the index.html that appears in the mentioned link using:
<script type="text/javascript" src="jwplayer-7.1.0/jwplayer.js"></script>
, the player doesn't work.
对于出现在提到的链接中的 index.html 使用:
<script type="text/javascript" src="jwplayer-7.1.0/jwplayer.js"></script>
,播放器无法工作。
<!DOCTYPE html>
<html>
<head>
<!-- JS jwplayer 6.8 -->
<script type="text/javascript" src="jwplayer-7.1.0/jwplayer.js"></script>
<!-- JWplayer Licence - put your licence here -->
<script type="text/javascript">jwplayer.key="....";</script>
<!-- Streamroot API (needs to be defined before the streamroot wrapper)-->
<script src="http://files.streamroot.io/release/1.1/api.js"></script>
<!-- Streamroot wrapper and loader -->
<script type="text/javascript">
streamrootWrapperSrc = "http://files.streamroot.io/release/1.1/wrappers/jwplayer/6.8/streamroot.wrapper.min.js";
</script>
<script type="text/javascript" src="http://files.streamroot.io/release/1.1/wrappers/jwplayer/6.8/srloader.js"></script>
</head>
<body>
<div id="streamrootPlayer" class="video">
</div>
<script>
jwplayer("streamrootPlayer").setup({
// Streamroot manifest source to place in the playlist
playlist : [{
sources: [
{ // HLS LIVE Manifest - works with Streamroot HTML5 and Flash modules.
file: "http://wowza.streamroot.io:1935/live/stream1/playlist.m3u8",
type: "application/x-mpegurl"
},
{ // MPEG-DASH VOD Manifest - works with Streamroot HTML5 and Flash modules.
file: "http://wowza.streamroot.io:1935/vod/snow.mp4/manifest.mpd",
type: "video/dash"
},/* { // RTMP LIVE Stream - if needed for fallbacks
file: "rtmp://wowza.streamroot.io:1935/live",
type: "video/rtmp"
}, { // MP4 VOD Stream - if needed for fallbacks
file: "http://content.jwplatform.com/videos/HkauGhRi-640.mp4",
type: "video/mp4"
}*/
]
}],
logo : {
file : "logo.jpg",
hide : true,
link : ""
},
abouttext : "Your About Text",
height: 360,
width: 640,
// enable streamroot playback and wrapper
primary: "streamroot",
streamrootplayer: "http://files.streamroot.io/release/1.1/wrappers/jwplayer/6.8/jwplayer.streamroot.js",
srflashplayer : "http://files.streamroot.io/release/1.1/wrappers/jwplayer/6.8/jwplayer.srflash.swf",
// streamroot API options
sr_options: {
ID_CLIENT : "ry-1t3stst12",
TRACKER_URL:"http://tracker.streamroot.io:80"
}
});
</script>
</body>
</html>
I suppose these Streamroot libs aren't suitable for jwplayer 7.1, but they aren't included in the downloaded folder. What am I doing wrong?
我想这些 Streamroot 库不适合 jwplayer 7.1,但它们不包含在下载的文件夹中。我究竟做错了什么?
Thanks you very much!
非常感谢你!
回答by Clément de Coligny
This Streamroot doc page is outdated. Check this one.
此 Streamroot 文档页面已过时。检查这个。
Try the above snippet. More info HERE.
试试上面的代码片段。更多信息在这里。
<!DOCTYPE html>
<html>
<head>
<script src="//p.jwpcdn.com/6/8/jwplayer.js"></script>
<script>jwplayer.key="CKjOe06GxAOe3Dj9NaWPCQKtqvqQdyFV8z9wsg==";</script>
<script src="//files.streamroot.io/release/latest/api.js"></script>
<script src="//files.streamroot.io/release/latest/wrappers/jwplayer/6.8/streamroot.wrapper.min.js"></script>
</head>
<body>
<div id="streamrootPlayer" class="video"></div>
<script>
jwplayer("streamrootPlayer").setup({
playlist : [
{ // PLACE YOUR MANIFEST URL HERE
file: "http://media.streamroot.io/dash/examples/snow15/snowboard1_720p_dash.mpd",
type: "video/dash"
},
{ // MP4 VOD Stream - fallback for old browsers and devices
file: "http://content.jwplatform.com/videos/HkauGhRi-640.mp4",
type: "video/mp4"
}
],
logo: {
hide: true,
file: ""
},
autostart: 1,
streamrootplayer: "http://files.streamroot.io/release/latest/wrappers/jwplayer/6.8/jwplayer.streamroot.js",
srflashplayer : "http://files.streamroot.io/release/latest/wrappers/jwplayer/6.8/jwplayer.srflash.swf",
sr_options: {
ID_CLIENT : "ry-1t3stst12",
DEBUG: true
}
});
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js"> </script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.9/d3.min.js"> </script>
<script src="http://files.streamroot.io/release/latest/scripts/p2pGraph.js"></script>
</body>
</html>