updateDashToken method
Updates the authentication token for the current DASH video stream.
This method is used for DASH stream that requires token-based authentication. The server hosting the DASH stream may have token validation enabled, requiring a valid token to be included in the request URL to access the video segments.
The dashToken parameter should contain the new authentication token string.
When this API is called, it will dynamically update the token used for
subsequent network requests. In the current implementation, the URL associated
with the video source must contain a placeholder segment in the format
"token=XXX". Calling this API will replace the "XXX" part of the placeholder
with the new dashToken value.
This method can only be called after the video player has been initialized and is currently playing a DASH format video. An exception will be thrown if called under other video formats.
Returns true if the token was successfully updated, false otherwise.
Implementation
Future<bool> updateDashToken(String dashToken) async {
if (_isDisposedOrNotInitialized) {
return false;
}
if (formatHint == null || formatHint != VideoFormat.dash) {
throw Exception('updateDashToken() only support for dash format!');
}
return _videoPlayerPlatform.updateDashToken(playerId, dashToken);
}