createParser static method

UrlParser createParser(
  1. Uri uri
)

Creates and returns a suitable UrlParser implementation according to the type of the provided uri.

uri: The URI of the video resource to be parsed.

Returns: An instance of UrlParser for the given URI.

Implementation

static UrlParser createParser(Uri uri) {
  if (VideoProxy.urlMatcherImpl.matchM3u8(uri) ||
      VideoProxy.urlMatcherImpl.matchM3u8Key(uri) ||
      VideoProxy.urlMatcherImpl.matchM3u8Segment(uri)) {
    return UrlParserM3U8();
  } else if (VideoProxy.urlMatcherImpl.matchMp4(uri)) {
    return UrlParserMp4();
  } else {
    // Returns the default parser for other file types.
    return UrlParserDefault();
  }
}