'Build a Brightcove url from a xml string containing
<object class="BrightcoveExperience">{params}</object>'

@classmethod
def _build_brighcove_url(cls, object_str):

    object_str = re.sub(u'(<param(?:\\s+[a-zA-Z0-9_]+="[^"]*")*)>', (lambda m: (m.group(1) + u'/>')), object_str)
    object_str = object_str.replace(u'<--', u'<!--')
    object_str = re.sub(u'(<object[^>]*)(xmlns=".*?")', u'\\1', object_str)
    object_str = fix_xml_ampersands(object_str)
    try:
        object_doc = compat_etree_fromstring(object_str.encode(u'utf-8'))
    except compat_xml_parse_error:
        return
    fv_el = find_xpath_attr(object_doc, u'./param', u'name', u'flashVars')
    if (fv_el is not None):
        flashvars = dict(((k, v[0]) for (k, v) in compat_parse_qs(fv_el.attrib[u'value']).items()))
    else:
        flashvars = {}
    data_url = object_doc.attrib.get(u'data', u'')
    data_url_params = compat_parse_qs(compat_urllib_parse_urlparse(data_url).query)
    def find_param(name):
        if (name in flashvars):
            return flashvars[name]
        node = find_xpath_attr(object_doc, u'./param', u'name', name)
        if (node is not None):
            return node.attrib[u'value']
        return data_url_params.get(name)
    params = {}
    playerID = (find_param(u'playerID') or find_param(u'playerId'))
    if (playerID is None):
        raise ExtractorError(u'Cannot    find    player    ID')
    params[u'playerID'] = playerID
    playerKey = find_param(u'playerKey')
    if (playerKey is not None):
        params[u'playerKey'] = playerKey
    videoPlayer = (find_param(u'@videoPlayer') or find_param(u'videoId') or find_param(u'videoID') or find_param(u'@videoList'))
    if (videoPlayer is not None):
        if isinstance(videoPlayer, list):
            videoPlayer = videoPlayer[0]
        videoPlayer = videoPlayer.strip()
        if (not (re.match(u'^(?:\\d+|[\\da-fA-F]{8}-?[\\da-fA-F]{4}-?[\\da-fA-F]{4}-?[\\da-fA-F]{4}-?[\\da-fA-F]{12})$', videoPlayer) or videoPlayer.startswith(u'ref:'))):
            return None
        params[u'@videoPlayer'] = videoPlayer
    linkBase = find_param(u'linkBaseURL')
    if (linkBase is not None):
        params[u'linkBaseURL'] = linkBase
    return cls._make_brightcove_url(params)
