setWebCrossOrigin method

Future<void> setWebCrossOrigin(
  1. WebCrossOrigin? webCrossOrigin
)

Set the crossorigin attribute on the <audio> element backing this player instance on web (see HTMLMediaElement crossorigin ).

If webCrossOrigin is null (the initial state), the URL will be fetched without CORS. If it is useCredentials, a CORS request will be made exchanging credentials (via cookies/certificates/HTTP authentication) regardless of the origin. If it is 'anonymous', a CORS request will be made, but credentials are exchanged only if the URL is fetched from the same origin.

Implementation

Future<void> setWebCrossOrigin(WebCrossOrigin? webCrossOrigin) async {
  if (_disposed) return;
  if (!kIsWeb && !_isUnitTest()) return;

  await (await _platform).setWebCrossOrigin(
    SetWebCrossOriginRequest(
        crossOrigin: webCrossOrigin == null
            ? null
            : WebCrossOriginMessage.values[webCrossOrigin.index]),
  );
  _webCrossOrigin = webCrossOrigin;
}