public function resolve($url)
    {
        $urlParts = parse_url($url);
        if (isset($urlParts['scheme']) && $urlParts['scheme'] === MediaService::SCHEME_NAME && isset($urlParts['host'])) {
            $mediaService = new MediaService();
            $mediaSource = $mediaService->getMediaSource($urlParts['host']);
            $mediaId = (isset($urlParts['path'])) ? trim($urlParts['path'], '/') : '';
            return new MediaAsset($mediaSource, $mediaId);
        } elseif (isset($urlParts['scheme']) && in_array($urlParts['scheme'], array('http','https'))) {
            return new MediaAsset(new HttpSource(), $url);
        } else {
            throw new TaoMediaException('Cannot resolve '.$url);
        }
    }