2e41348d by David LaPalomento

Make sure endOfStream is called

When the last segment in a playlist is appended, call endOfStream. There was an off-by-one error calculating when the final segment was delivered. Mock out endOfStream for test cases so exceptions aren't thrown. For #111. This commit stops the spinner from showing up when a video has finished but hitting play again to restart the video is not currently working.
1 parent a55fc47b
...@@ -533,7 +533,9 @@ var ...@@ -533,7 +533,9 @@ var
533 // we're done processing this segment 533 // we're done processing this segment
534 segmentBuffer.shift(); 534 segmentBuffer.shift();
535 535
536 if (mediaIndex === playlist.segments.length) { 536 // transition the sourcebuffer to the ended state if we've hit the end of
537 // the playlist
538 if (mediaIndex + 1 === playlist.segments.length) {
537 mediaSource.endOfStream(); 539 mediaSource.endOfStream();
538 } 540 }
539 }; 541 };
......