1fcab4ef by Gary Katsevman

Make sure that segments attribute exists.

1 parent 173a40ec
...@@ -127,8 +127,10 @@ videojs.Hls.prototype.handleSourceOpen = function() { ...@@ -127,8 +127,10 @@ videojs.Hls.prototype.handleSourceOpen = function() {
127 oldMediaPlaylist = this.playlists.media(); 127 oldMediaPlaylist = this.playlists.media();
128 this.bandwidth = this.playlists.bandwidth; 128 this.bandwidth = this.playlists.bandwidth;
129 selectedPlaylist = this.selectPlaylist(); 129 selectedPlaylist = this.selectPlaylist();
130 newBitrate = selectedPlaylist.attributes && selectedPlaylist.attributes.BANDWIDTH; 130 newBitrate = selectedPlaylist.attributes &&
131 segmentDuration = oldMediaPlaylist.segments[this.mediaIndex].duration || 131 selectedPlaylist.attributes.BANDWIDTH;
132 segmentDuration = oldMediaPlaylist.segments &&
133 oldMediaPlaylist.segments[this.mediaIndex].duration ||
132 oldMediaPlaylist.targetDuration; 134 oldMediaPlaylist.targetDuration;
133 135
134 segmentDlTime = (segmentDuration * newBitrate) / this.bandwidth; 136 segmentDlTime = (segmentDuration * newBitrate) / this.bandwidth;
......