TypeError on some browsers when loading stream with future AST after #1899
Created by: davemevans
We are seeing a TypeError (The expression cannot be converted to return the specified type.
in Firefox) being throw on browsers supporting setLiveSeekableRange
when attempting to play streams which have not started yet i.e. with an availabilityStartTime in the future, since #1899 was merged.
It appears that, despite the stream not having started yet, a non-zero length segment availability range is calculated. This is incorrect - no segments are available before availabilityStartTime. Additionally, and fatally, incorrect is that the availability window is calculated to have a zero start time and negative end time!
The MSE spec is clear that:
If start is negative or greater than end, then throw a TypeError exception and abort these steps.
so we should definitely be checking for that condition and not calling setLiveSeekableRange
.
Further, it states:
If the readyState attribute is not "open" then throw an InvalidStateError exception and abort these steps.
so there should probably also be a check for that, as there is in signalEndOfStream
in the same module.
However, IMO, the underlying problem is the incorrect range calculation.
I can't share a stream unfortunately, but we should be able to provide a fix for at least the first bit.