1fcab4ef by Gary Katsevman

Make sure that segments attribute exists.

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