Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

HLS Tech #62

Merged
merged 14 commits into from
May 21, 2014
10 changes: 6 additions & 4 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="node_modules/video.js/dist/video-js/video-js.css" rel="stylesheet">

<!-- video.js -->
<script src="node_modules/video.js/dist/video-js/video.js"></script>
<script src="node_modules/video.js/dist/video-js/video.dev.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkatsev - Should this be pushed back to non-dev version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably.


<!-- Media Sources plugin -->
<script src="node_modules/videojs-contrib-media-sources/src/videojs-media-sources.js"></script>
Expand All @@ -31,7 +31,7 @@
<!-- bipbop -->
<!-- <script src="test/tsSegment.js"></script> -->
<!-- bunnies -->
<script src="test/tsSegment-bc.js"></script>
<!--<script src="test/tsSegment-bc.js"></script>-->

<style>
body {
Expand Down Expand Up @@ -63,10 +63,12 @@
<script>
videojs.options.flash.swf = 'node_modules/video.js/dist/video-js/video-js.swf';
// initialize the player
var player = videojs('video');
var player = videojs('video', {
techOrder: ['hls']
});

// initialize the plugin
player.hls();
//player.hls()
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/aac-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

(function(window) {
var
FlvTag = window.videojs.hls.FlvTag,
FlvTag = window.videojs.Hls.FlvTag,
adtsSampleingRates = [
96000, 88200,
64000, 48000,
Expand All @@ -17,7 +17,7 @@ var
16000, 12000
];

window.videojs.hls.AacStream = function() {
window.videojs.Hls.AacStream = function() {
var
next_pts, // :uint
pts_offset, // :int
Expand Down
2 changes: 1 addition & 1 deletion src/bin-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
}
};

window.videojs.hls.utils = module;
window.videojs.Hls.utils = module;
})(this);
2 changes: 1 addition & 1 deletion src/exp-golomb.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Parser for exponential Golomb codes, a variable-bitwidth number encoding
* scheme used by h264.
*/
window.videojs.hls.ExpGolomb = function(workingData) {
window.videojs.Hls.ExpGolomb = function(workingData) {
var
// the number of bytes left to examine in workingData
workingBytesAvailable = workingData.byteLength,
Expand Down
4 changes: 2 additions & 2 deletions src/flv-tag.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(function(window) {

window.videojs = window.videojs || {};
window.videojs.hls = window.videojs.hls || {};
window.videojs.Hls = window.videojs.Hls || {};

var hls = window.videojs.hls;
var hls = window.videojs.Hls;

// (type:uint, extraData:Boolean = false) extends ByteArray
hls.FlvTag = function(type, extraData) {
Expand Down
8 changes: 4 additions & 4 deletions src/h264-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

(function(window) {
var
ExpGolomb = window.videojs.hls.ExpGolomb,
FlvTag = window.videojs.hls.FlvTag,
ExpGolomb = window.videojs.Hls.ExpGolomb,
FlvTag = window.videojs.Hls.FlvTag,

H264ExtraData = function() {
this.sps = []; // :Array
Expand Down Expand Up @@ -234,7 +234,7 @@
* an h264 stream. Exactly one byte.
*/
// incomplete, see Table 7.1 of ITU-T H.264 for 12-32
window.videojs.hls.NALUnitType = NALUnitType = {
window.videojs.Hls.NALUnitType = NALUnitType = {
unspecified: 0,
slice_layer_without_partitioning_rbsp_non_idr: 1,
slice_data_partition_a_layer_rbsp: 2,
Expand All @@ -249,7 +249,7 @@
end_of_stream_rbsp: 11
};

window.videojs.hls.H264Stream = function() {
window.videojs.Hls.H264Stream = function() {
var
next_pts, // :uint;
next_dts, // :uint;
Expand Down
2 changes: 1 addition & 1 deletion src/m3u8/m3u8-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
return result;
},
Stream = videojs.hls.Stream,
Stream = videojs.Hls.Stream,
LineStream,
ParseStream,
Parser;
Expand Down
22 changes: 16 additions & 6 deletions src/playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
(function(window, videojs) {
'use strict';
var
resolveUrl = videojs.hls.resolveUrl,
xhr = videojs.hls.xhr,
resolveUrl = videojs.Hls.resolveUrl,
xhr = videojs.Hls.xhr,

/**
* Returns a new master playlist that is the result of merging an
Expand Down Expand Up @@ -51,6 +51,7 @@
var
loader = this,
media,
mediaUpdateTimeout,
request,

haveMetadata = function(error, xhr, url) {
Expand Down Expand Up @@ -88,7 +89,7 @@

// refresh live playlists after a target duration passes
if (!loader.media().endList) {
window.setTimeout(function() {
mediaUpdateTimeout = window.setTimeout(function() {
loader.trigger('mediaupdatetimeout');
}, refreshDelay);
}
Expand All @@ -104,6 +105,13 @@

loader.state = 'HAVE_NOTHING';

loader.dispose = function() {
if (request) {
request.abort();
}
window.clearTimeout(mediaUpdateTimeout);
};

/**
* When called without any arguments, returns the currently
* active media playlist. When called with a single argument,
Expand Down Expand Up @@ -213,7 +221,9 @@
haveMetadata(error,
this,
parser.manifest.playlists[0].uri);
loader.trigger('loadedmetadata');
if (!error) {
loader.trigger('loadedmetadata');
}
});
return loader.trigger('loadedplaylist');
}
Expand All @@ -231,7 +241,7 @@
return loader.trigger('loadedmetadata');
});
};
PlaylistLoader.prototype = new videojs.hls.Stream();
PlaylistLoader.prototype = new videojs.Hls.Stream();

videojs.hls.PlaylistLoader = PlaylistLoader;
videojs.Hls.PlaylistLoader = PlaylistLoader;
})(window, window.videojs);
12 changes: 6 additions & 6 deletions src/segment-parser.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
(function(window) {
var
videojs = window.videojs,
FlvTag = videojs.hls.FlvTag,
H264Stream = videojs.hls.H264Stream,
AacStream = videojs.hls.AacStream,
FlvTag = videojs.Hls.FlvTag,
H264Stream = videojs.Hls.H264Stream,
AacStream = videojs.Hls.AacStream,
MP2T_PACKET_LENGTH,
STREAM_TYPES;

/**
* An object that incrementally transmuxes MPEG2 Trasport Stream
* chunks into an FLV.
*/
videojs.hls.SegmentParser = function() {
videojs.Hls.SegmentParser = function() {
var
self = this,
parseTSPacket,
Expand Down Expand Up @@ -432,8 +432,8 @@
};

// MPEG2-TS constants
videojs.hls.SegmentParser.MP2T_PACKET_LENGTH = MP2T_PACKET_LENGTH = 188;
videojs.hls.SegmentParser.STREAM_TYPES = STREAM_TYPES = {
videojs.Hls.SegmentParser.MP2T_PACKET_LENGTH = MP2T_PACKET_LENGTH = 188;
videojs.Hls.SegmentParser.STREAM_TYPES = STREAM_TYPES = {
h264: 0x1b,
adts: 0x0f
};
Expand Down
2 changes: 1 addition & 1 deletion src/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@
});
};

videojs.hls.Stream = Stream;
videojs.Hls.Stream = Stream;
})(window.videojs);
Loading