asynchronous request filters #610
Labels
flag: good first issue
This might be a relatively easy issue; good for new contributors
status: archived
Archived and locked; will not be updated
type: enhancement
New feature or request
Milestone
I am currently using v1 which allows request intercepting via
source.setNetworkCallback(foo)
and I believe the v2 equivalent for this isplayer.getNetworkingEngine().registerRequestFilter(foo)
In both cases I want to make a network request (or some async operation) inside
foo
, the result of which will be used in the actual filtering.An example would be that I need to intercept all dash requests and decorate the headers with an authentication token. However this token may have expired half way during playback of the video. So I need to fetch a new token before allowing the next dash network request to happen. Essentially pausing it.
My current workaround is to increase the number of network retries for the dash player, and manage the token refresh outside the scope of the player network interceptor. This isolated token refresh request then alters some scope variable that function
foo
can eventually read. This works but is hacky and results in bunch of errors, say 401, but having a high retry count (and coupled with the new v2backoffFactor
) gets this going.Another example would be that the dash player requests for a segment, however that response returns, say a 202, suggesting that the segment is still transcoding on the backend and not ready. One would like to prevent further requests till some async job suggests that the segment is ready and is OK to continue.
Can
player.getNetworkingEngine().registerRequestFilter(foo)
havefoo
that returns a promise which resolves to a modifiedshakaExtern.Request
upon which it should make the actual dash request.The text was updated successfully, but these errors were encountered: