public function detectMediaType($url)
    {
        foreach ($this->availableTypes as $type) {
            if (starts_with($url, $type . ':')) {
                return $type;
            }
        }

        if (giga_match('%(.jpg|.png|.bmp|.gif|.jpeg|.tiff|.gif)%', $url)) {
            return 'image';
        }

        if (giga_match('%(.avi|.flv|.mp4|.mkv|.3gp|.webm|.vob|.mov|.rm|.rmvb)%', $url)) {
            return 'video';
        }

        if (giga_match('%(.mp3|.wma|.midi|.au)%', $url)) {
            return 'audio';
        }

        return null;
    }