createParser static method
Creates and returns a suitable UrlParser implementation
according to the type of the provided uri
.
- If the URI matches an M3U8 playlist, key, or segment, returns UrlParserM3U8.
- If the URI matches an MP4 file, returns UrlParserMp4.
- Otherwise, returns UrlParserDefault.
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();
}
}