On loadedmetadata and timeupdate, check the length of content from the current playhead position to the end of the buffer. If the amount of time buffered is less than a goal size of 5 seconds, download another segment of the video. For this algorithm to work, it requires an update to the video.js swf to expose the bufferLength property on the netstream directly. Added a fix so that once all segments are downloaded, the plugin does not attempt to continue downloading segments.
Track the XHR duration and use that to figure out bandwidth when downloading segments. Ensure a fresh instance is assigned to player.hls on each plugin invocation so that state attached to the plugin object is not retained across loads.
Test for relative URIs when reading segment manifests and resolve them against the location of the manifest itself. Update test harness to support using different test manifests as XHR responses.
Move more of the manifest management and segment loading into a more customary location for a plugin implementation. Get a single segment downloading and playing. Add test cases for the plugin initialization and first segment download. Use a linked version of media sources to pick up an event listening implementation on SourceBuffer that doesn't require an unminified version of video.js.
There are a ton of tests in m3u8_test.js currently and it's getting a bit difficult to manage. Instead of hand-writing checks for each property of the parsed output, automatically convert manifests to javscript strings during the build process and then compare the parse of that string against a JSON file with the same name.
Create a parser that interprets parsing events and produces a manifest object. Get all the tests working. Comment a few manifest controller tests out because the interface of that object needs to be updated to use the new parser.
Regexes and tests for m3u8 tags that are likely to be relevant to playback. High-level m3u8 tests are still failing because their is still no "interpretation" of the incoming parse stream.
Split parsing into tokenization and a very liberal parser. After this, an "interpreter" needs to be created to build an object representation of the manifest based on the events emitted by the parser. Higher-level manifest tests are broken until that interpreter is written.
Add the peg parser generation step to the gruntfile. Include the generated parser in the test harness page. Update many of the m3u8 tests to work with the new parser. There are a number of tests still failing. I believe this is because parts of the grammar are not sufficiently flexible to handle some optional parameters. For instance, #EXT-X-BYTE-RANGE is being glommed incorrectly into the #EXTINF definition and that's throwing off parsing. This commit is a progress checkpoint; things are definitely not working correctly.
Rename mediaFile to mediaURL in segment and rendition
Rename byteRange into byterange and default it to -1 in segment
Rename duration to targetDuration in segment
Generate the parser file via 'npm run peg'.
There is a simple test script in test/pegtest.js.
The test can be run via 'npm run testpeg' which will generate a new copy
of the parser and then run the test file.