cef4cc56 by David LaPalomento

Update README

Fix up the readme with all the changes in 1.x.
1 parent 61350b49
Showing 1 changed file with 66 additions and 42 deletions
1 # video.js HLS Tech 1 # video.js HLS Source Handler
2 2
3 A video.js tech that plays HLS video on platforms that don't support it but have Flash. 3 Play back HLS with video.js, even where it's not natively supported.
4 4
5 [![Build Status](https://travis-ci.org/videojs/videojs-contrib-hls.svg?branch=master)](https://travis-ci.org/videojs/videojs-contrib-hls) 5 [![Build Status](https://travis-ci.org/videojs/videojs-contrib-hls.svg?branch=master)](https://travis-ci.org/videojs/videojs-contrib-hls)
6 6
7 ## Getting Started 7 ## Getting Started
8 Download [videojs-contrib-media-sources](https://github.com/videojs/videojs-contrib-media-sources/releases) and [videojs-contrib-hls](https://github.com/videojs/videojs-contrib-hls/releases). Include them both in your web page along with video.js: 8 Download
9 [videojs-contrib-hls](https://github.com/videojs/videojs-contrib-hls/releases)
10 and include it in your page along with video.js:
9 11
10 ```html 12 ```html
11 <video id=example-video width=600 height=300 class="video-js vjs-default-skin" controls> 13 <video id=example-video width=600 height=300 class="video-js vjs-default-skin" controls>
...@@ -14,7 +16,6 @@ Download [videojs-contrib-media-sources](https://github.com/videojs/videojs-cont ...@@ -14,7 +16,6 @@ Download [videojs-contrib-media-sources](https://github.com/videojs/videojs-cont
14 type="application/x-mpegURL"> 16 type="application/x-mpegURL">
15 </video> 17 </video>
16 <script src="video.js"></script> 18 <script src="video.js"></script>
17 <script src="videojs-media-sources.js"></script>
18 <script src="videojs-hls.min.js"></script> 19 <script src="videojs-hls.min.js"></script>
19 <script> 20 <script>
20 var player = videojs('example-video'); 21 var player = videojs('example-video');
...@@ -41,30 +42,40 @@ position of having to maintain alternate renditions of the same video ...@@ -41,30 +42,40 @@ position of having to maintain alternate renditions of the same video
41 and potentially having to forego HTML-based video entirely to provide 42 and potentially having to forego HTML-based video entirely to provide
42 the best desktop viewing experience. 43 the best desktop viewing experience.
43 44
44 This tech attempts to address that situation by providing a polyfill 45 This project addresses that situation by providing a polyfill for HLS
45 for HLS on browsers that have Flash support. You can deploy a single 46 on browsers that have support for [Media Source
46 HLS stream, code against the regular HTML5 video APIs, and create a 47 Extensions](http://caniuse.com/#feat=mediasource), or failing that,
47 fast, high-quality video experience across all the big web device 48 support Flash. You can deploy a single HLS stream, code against the
48 categories. 49 regular HTML5 video APIs, and create a fast, high-quality video
50 experience across all the big web device categories.
49 51
50 Check out the [full documentation](docs/) for details on how HLS works 52 Check out the [full documentation](docs/) for details on how HLS works
51 and advanced configuration. A description of the [adaptive switching 53 and advanced configuration. A description of the [adaptive switching
52 behavior](docs/bitrate-switching.md) is available, too. 54 behavior](docs/bitrate-switching.md) is available, too.
53 55
54 The videojs-hls tech is still working towards a 1.0 release so it 56 videojs-contrib-hls support a bunch of HLS v2 and v3 features. Here
55 may not fit your requirements today. Specifically, there is _no_ 57 are some highlights:
56 support for: 58
57 59 - video-on-demand and live playback modes
58 - Alternate audio and video tracks 60 - backup or redundant streams
59 - Subtitles 61 - mid-segment quality switching
60 - Segment codecs _other than_ H.264 with AAC audio 62 - AES-128 segment encryption
61 - Internet Explorer < 10 63 - CEA-608 captions are automatically translated into standard HTML5
64 [caption text
65 tracks](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track)
66 - Timed ID3 Metadata is automatically translated into HTML5 metedata
67 text tracks
68 - Highly customizable adaptive bitrate selection
69 - Automatic bandwidth tracking
70 - Cross-domain credentials support with CORS
71 - Tight integration with video.js and a philosophy of exposing as much
72 as possible with standard HTML APIs
62 73
63 ### Options 74 ### Options
64 75
65 You may pass in an options object to the hls tech at player 76 You may pass in an options object to the hls source handler at player
66 initialization. You can pass in options just like you would for any 77 initialization. You can pass in options just like you would for other
67 other tech: 78 parts of video.js:
68 79
69 ```javascript 80 ```javascript
70 videojs(video, { 81 videojs(video, {
...@@ -88,14 +99,28 @@ See html5rocks's [article](http://www.html5rocks.com/en/tutorials/cors/) ...@@ -88,14 +99,28 @@ See html5rocks's [article](http://www.html5rocks.com/en/tutorials/cors/)
88 for more info. 99 for more info.
89 100
90 ### Runtime Properties 101 ### Runtime Properties
91 #### player.hls.playlists.master 102 Runtime properties are attached to the tech object when HLS is in
103 use. You can get a reference to the HLS source handler like this:
104
105 ```js
106 var hls = player.tech({ IWillNotUseThisInPlugins: true }).hls;
107 ```
108
109 If you *were* thinking about modifying runtime properties in a
110 video.js plugin, we'd recommend you avoid it. Your plugin won't work
111 with videos that don't use videojs-contrib-hls and the best plugins
112 work across all the media types that video.js supports. If you're
113 deploying videojs-contrib-hls on your own website and want to make a
114 couple tweaks though, go for it!
115
116 #### hls.playlists.master
92 Type: `object` 117 Type: `object`
93 118
94 An object representing the parsed master playlist. If a media playlist 119 An object representing the parsed master playlist. If a media playlist
95 is loaded directly, a master playlist with only one entry will be 120 is loaded directly, a master playlist with only one entry will be
96 created. 121 created.
97 122
98 #### player.hls.playlists.media 123 #### hls.playlists.media
99 Type: `function` 124 Type: `function`
100 125
101 A function that can be used to retrieve or modify the currently active 126 A function that can be used to retrieve or modify the currently active
...@@ -108,19 +133,13 @@ will kick off an asynchronous load of the specified media ...@@ -108,19 +133,13 @@ will kick off an asynchronous load of the specified media
108 playlist. Once it has been retreived, it will become the active media 133 playlist. Once it has been retreived, it will become the active media
109 playlist. 134 playlist.
110 135
111 #### player.hls.mediaIndex 136 #### hls.segmentXhrTime
112 Type: `number`
113
114 The index of the next video segment to be downloaded from
115 `player.hls.media`.
116
117 #### player.hls.segmentXhrTime
118 Type: `number` 137 Type: `number`
119 138
120 The number of milliseconds it took to download the last media segment. 139 The number of milliseconds it took to download the last media segment.
121 This value is updated after each segment download completes. 140 This value is updated after each segment download completes.
122 141
123 #### player.hls.bandwidth 142 #### hls.bandwidth
124 Type: `number` 143 Type: `number`
125 144
126 The number of bits downloaded per second in the last segment download. 145 The number of bits downloaded per second in the last segment download.
...@@ -134,12 +153,12 @@ have a more accurate source of bandwidth information, you can override ...@@ -134,12 +153,12 @@ have a more accurate source of bandwidth information, you can override
134 this value as soon as the HLS tech has loaded to provide an initial 153 this value as soon as the HLS tech has loaded to provide an initial
135 bandwidth estimate. 154 bandwidth estimate.
136 155
137 #### player.hls.bytesReceived 156 #### hls.bytesReceived
138 Type: `number` 157 Type: `number`
139 158
140 The total number of content bytes downloaded by the HLS tech. 159 The total number of content bytes downloaded by the HLS tech.
141 160
142 #### player.hls.selectPlaylist 161 #### hls.selectPlaylist
143 Type: `function` 162 Type: `function`
144 163
145 A function that returns the media playlist object to use to download 164 A function that returns the media playlist object to use to download
...@@ -149,6 +168,11 @@ adaptive streaming logic. You must, however, be sure to return a valid ...@@ -149,6 +168,11 @@ adaptive streaming logic. You must, however, be sure to return a valid
149 media playlist object that is present in `player.hls.master`. 168 media playlist object that is present in `player.hls.master`.
150 169
151 ### Events 170 ### Events
171 Standard HTML video events are handled by video.js automatically and
172 are triggered on the player object. In addition, there are a couple
173 specialized events you can listen to on the HLS object during
174 playback:
175
152 #### loadedmetadata 176 #### loadedmetadata
153 177
154 Fired after the first media playlist is downloaded for a stream. 178 Fired after the first media playlist is downloaded for a stream.
...@@ -187,6 +211,16 @@ cue.frame.data ...@@ -187,6 +211,16 @@ cue.frame.data
187 There are lots of guides and references to using text tracks [around 211 There are lots of guides and references to using text tracks [around
188 the web](http://www.html5rocks.com/en/tutorials/track/basics/). 212 the web](http://www.html5rocks.com/en/tutorials/track/basics/).
189 213
214 ## Hosting Considerations
215 Unlike a native HLS implementation, the HLS tech has to comply with
216 the browser's security policies. That means that all the files that
217 make up the stream must be served from the same domain as the page
218 hosting the video player or from a server that has appropriate [CORS
219 headers](https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS)
220 configured. Easy [instructions are
221 available](http://enable-cors.org/server.html) for popular webservers
222 and most CDNs should have no trouble turning CORS on for your account.
223
190 ### Testing 224 ### Testing
191 225
192 For testing, you can either run `npm test` or use `grunt` directly. 226 For testing, you can either run `npm test` or use `grunt` directly.
...@@ -210,15 +244,5 @@ Possible options are: ...@@ -210,15 +244,5 @@ Possible options are:
210 _<sup>1</sup>supported end-to-end browsers_<br /> 244 _<sup>1</sup>supported end-to-end browsers_<br />
211 _<sup>2</sup>requires the [SafariDriver extension]( https://code.google.com/p/selenium/wiki/SafariDriver) to be installed_ 245 _<sup>2</sup>requires the [SafariDriver extension]( https://code.google.com/p/selenium/wiki/SafariDriver) to be installed_
212 246
213 ## Hosting Considerations
214 Unlike a native HLS implementation, the HLS tech has to comply with
215 the browser's security policies. That means that all the files that
216 make up the stream must be served from the same domain as the page
217 hosting the video player or from a server that has appropriate [CORS
218 headers](https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS)
219 configured. Easy [instructions are
220 available](http://enable-cors.org/server.html) for popular webservers
221 and most CDNs should have no trouble turning CORS on for your account.
222
223 ## Release History 247 ## Release History
224 Check out the [changelog](CHANGELOG.md) for a summary of each release. 248 Check out the [changelog](CHANGELOG.md) for a summary of each release.
......