getMediaSource method

MediaSource getMediaSource(
  1. String? mediaPath
)
inherited

Implementation

MediaSource getMediaSource(String? mediaPath) {
  if (mediaPath != null) {
    if (RegExp(r'^https?:\/\/').hasMatch(mediaPath)) {
      return MediaSource.Network;
    }

    if (RegExp(r'^file:\/\/').hasMatch(mediaPath)) {
      return MediaSource.File;
    }

    if (RegExp(r'^asset:\/\/').hasMatch(mediaPath)) {
      return MediaSource.Asset;
    }

    if (RegExp(r'^resource:\/\/').hasMatch(mediaPath)) {
      return MediaSource.Resource;
    }
  }
  return MediaSource.Unknown;
}