JWPlayer使用指南

http://support.jwplayer.com/customer/portal/articles/1499103-quickstart-reference

<div id="myElement">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement").setup({
	file: "http://example.com/uploads/myVideo.mp4",
	image: "http://example.com/uploads/myPoster.jpg",
	width: 640,
	height: 360
});

jwplayer("myElement").setup({
	file: "http://example.com/uploads/myAudio.m4a",
	width: 640,
	height: 30
});

jwplayer("myElement").setup({
    file: "/assets/myLiveStream.m3u8",
    image: "/assets/myPoster.jpg"
});

jwplayer("myElement").setup({
    playlist: [{
        image: "/assets/myPoster.jpg",
        sources: [{ 
            file: "/assets/myStream.m3u8"
        },{
            file: "/assets/myVideo.mp4"
        }]
    }],
    primary: "flash"
});
we also has the primary option set to flash. If this is not set, the JW Player will attempt to play the video in HTML5.

jwplayer("myElement").setup({
    file: "rtmp://example.com/application/mp4:myVideo.mp4",
    image: "/assets/myVideo.jpg",
    height: 360,
    width: 640
});

jwplayer("myElement").setup({
    playlist: [{
        image: "/assets/myVideo.jpg",
        sources: [{ 
            file: "rtmp://example.com/application/mp4:myVideo.mp4"
        },{
            file: "/assets/myVideo.mp4"
        }]
    }],
    height: 360,
    primary: "flash",
    width: 640
});
The RTMP stream will be played on desktops, the HTTP download will be played on devices, since many browsers support that in HTML5 
rtmp://example.com/vod/mp4:myFolder/myVideo.mp4
rtmp://example.com/vod/flv:myFolder/myVideo.flv
rtmp://example.com/live/flv:myFolder/myLiveStream
rtmp://example.com/vod/mp3:myFolder/mySong.mp3
rtmp://example.com/vod/mp4:myFolder/mySong.m4a
If no prefix is found, the player splits application/stream after the last / in the filename

jwplayer("myElement").setup({
    file: "rtmp://example.com/vod/mp4:myVideo.mp4",
    height: 360,
    image: "/assets/myVideo.jpg",
    rtmp: {
        bufferlength: 0.1
    },
    width: 640
});

jwplayer("myElement").setup({
    file: "rtmp://example.com/xxxx/myStream",
    height: 360,
    image: "/assets/myLivestream.jpg",
    rtmp: {
        subscribe: true
    },
    width: 640
});
When streaming RTMP live streams using the Akamai, Edgecast or Limelight CDN, players cannot simply connect to the live stream. 
Instead, they have to subscribe to it, by sending a so-called FC Subscribe call to the server.

Basic Options
1.aspectratio
This option, used to setup JW Player for responsive design, is set to the video display aspect ratio, for example "16:9". When 
the width of the player changes, it then automatically scales its height accordingly. When the aspectratio is set, the height 
option is ignored
2.autostart
Automatically start playing the video on page load. Can be true or false (default). Autostart does not work on mobile devices (iOS and Android)
3.controls
Whether to display the video controls (controlbar, display icons and dock buttons). Can be false or true (default). When false,
use the JavaScript API to control the chromeless player
4.file
URL to a single video file, audio file, YouTube video or live stream to play. See for example the MP4 Video Embed article.
Note this option is ignored if the playlist configuration block is used
5.height
Height of the player in pixels. We recommend setting this to at least 180, so all UI elements will fit. However, it can be set 
to a small size (e.g. 40) for audio-only playback. Defaults to 270
6.width
Width of the player. Defaults to 480 pixels. We recommend setting this to at least 320 pixels, since otherwise certain UI elements
may not fit. It can also be set to "100%" to enable responsive design, in combination with the aspectratio option
7.image
URL to a poster image to display before playback starts. For audio-only media, the poster image stays visible during playback. See
for example the MP4 Video Embed article. Note this option is ignored if the playlist configuration block is used
8.mute
Whether to have the sound muted on startup or not. Can be false (default) or true. Mute does not work on mobile devices (iOS and Android).
9.primary
Which rendering mode to use for rendering the player if both are available. Can be html5 (default) or flash
10.repeat
Whether to loop playback of the playlist or not. Can be true (keep playing forever) or false (stop playback when completed). Defaults to false.
11.skin
Which skin to use for styling the player (the default skin is named Six). Is set to either the name of one of our 
8 Pro skins (e.g. five) or the URL of a custom skin (e.g. http://example.com/skin.xml)
12.androidhls
The default value for this flag is false. Set this value to true if you would like the JW Player to play HLS video
sources on Android devices 4.1 and greater

  

posted @ 2014-08-08 23:28  腐烂的翅膀  阅读(2102)  评论(0编辑  收藏  举报