当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLMediaElement::setSrc方法代码示例

本文整理汇总了C++中HTMLMediaElement::setSrc方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLMediaElement::setSrc方法的具体用法?C++ HTMLMediaElement::setSrc怎么用?C++ HTMLMediaElement::setSrc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLMediaElement的用法示例。


在下文中一共展示了HTMLMediaElement::setSrc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createDocumentStructure

void MediaDocumentParser::createDocumentStructure()
{
    ExceptionCode ec;
    RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
    document()->appendChild(rootElement, ec);
    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();

    if (document()->frame())
        document()->frame()->loader()->dispatchDocumentElementAvailable();
        
    RefPtr<Element> body = document()->createElement(bodyTag, false);
    body->setAttribute(styleAttr, "background-color: rgb(38,38,38);");

    rootElement->appendChild(body, ec);
        
    RefPtr<Element> mediaElement = document()->createElement(videoTag, false);
        
    m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get());
    m_mediaElement->setAttribute(controlsAttr, "");
    m_mediaElement->setAttribute(autoplayAttr, "");
    m_mediaElement->setAttribute(styleAttr, "margin: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0;");

    m_mediaElement->setAttribute(nameAttr, "media");
    m_mediaElement->setSrc(document()->url());
    
    body->appendChild(mediaElement, ec);

    Frame* frame = document()->frame();
    if (!frame)
        return;

    frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(DoNotBufferData);
}
开发者ID:1833183060,项目名称:wke,代码行数:33,代码来源:MediaDocument.cpp

示例2: createDocumentStructure

void MediaTokenizer::createDocumentStructure()
{
    ExceptionCode ec;
    RefPtr<Element> rootElement = m_doc->createElementNS(xhtmlNamespaceURI, "html", ec);
    m_doc->appendChild(rootElement, ec);
        
    RefPtr<Element> body = m_doc->createElementNS(xhtmlNamespaceURI, "body", ec);
    body->setAttribute(styleAttr, "background-color: rgb(38,38,38);");

    rootElement->appendChild(body, ec);
        
    RefPtr<Element> mediaElement = m_doc->createElementNS(xhtmlNamespaceURI, "video", ec);
        
    m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get());
    m_mediaElement->setAttribute(controlsAttr, "");
    m_mediaElement->setAttribute(autoplayAttr, "");
    m_mediaElement->setAttribute(styleAttr, "margin: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0;");

    m_mediaElement->setAttribute(nameAttr, "media");
    m_mediaElement->setSrc(m_doc->url());
    
    body->appendChild(mediaElement, ec);

    Frame* frame = m_doc->frame();
    if (!frame)
        return;

    frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:29,代码来源:MediaDocument.cpp

示例3: putValueProperty

void JSHTMLMediaElement::putValueProperty(ExecState* exec, int token, JSValue* value)
{
    switch (token) {
    case SrcAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setSrc(value->toString(exec));
        break;
    }
    case CurrentTimeAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        ExceptionCode ec = 0;
        imp->setCurrentTime(value->toFloat(exec), ec);
        setDOMException(exec, ec);
        break;
    }
    case DefaultPlaybackRateAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        ExceptionCode ec = 0;
        imp->setDefaultPlaybackRate(value->toFloat(exec), ec);
        setDOMException(exec, ec);
        break;
    }
    case PlaybackRateAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        ExceptionCode ec = 0;
        imp->setPlaybackRate(value->toFloat(exec), ec);
        setDOMException(exec, ec);
        break;
    }
    case AutoplayAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setAutoplay(value->toBoolean(exec));
        break;
    }
    case StartAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setStart(value->toFloat(exec));
        break;
    }
    case EndAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setEnd(value->toFloat(exec));
        break;
    }
    case LoopStartAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setLoopStart(value->toFloat(exec));
        break;
    }
    case LoopEndAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setLoopEnd(value->toFloat(exec));
        break;
    }
    case PlayCountAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        ExceptionCode ec = 0;
        imp->setPlayCount(value->toInt32(exec), ec);
        setDOMException(exec, ec);
        break;
    }
    case CurrentLoopAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setCurrentLoop(value->toInt32(exec));
        break;
    }
    case ControlsAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setControls(value->toBoolean(exec));
        break;
    }
    case VolumeAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        ExceptionCode ec = 0;
        imp->setVolume(value->toFloat(exec), ec);
        setDOMException(exec, ec);
        break;
    }
    case MutedAttrNum: {
        HTMLMediaElement* imp = static_cast<HTMLMediaElement*>(impl());
        imp->setMuted(value->toBoolean(exec));
        break;
    }
    }
}
开发者ID:achellies,项目名称:ISeeBrowser,代码行数:85,代码来源:JSHTMLMediaElement.cpp

示例4: createDocumentStructure

void MediaDocumentParser::createDocumentStructure()
{
    ExceptionCode ec;
    RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
    document()->appendChild(rootElement, ec);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
#endif

    if (document()->frame())
        document()->frame()->loader()->dispatchDocumentElementAvailable();
        
    RefPtr<Element> body = document()->createElement(bodyTag, false);
    body->setAttribute(styleAttr, "background-color: rgb(38,38,38);");

    rootElement->appendChild(body, ec);

#if PLATFORM(BLACKBERRY) && OS(QNX)
    // Use the name of the media file as the document title
    if (document()->title().isEmpty()) {
        const KURL& url = document()->url();
        if (url.isValid()) {
            document()->setTitle(decodeURLEscapeSequences(url.lastPathComponent()));
        }
    }
    RefPtr<Element> div = document()->createElement(divTag, false);
    div->setAttribute(styleAttr, "margin-top: 40px; text-align: center; vertical-align: center;");

    body->appendChild(div, ec);
#endif
        
    RefPtr<Element> mediaElement = document()->createElement(videoTag, false);
        
    m_mediaElement = static_cast<HTMLVideoElement*>(mediaElement.get());
    m_mediaElement->setAttribute(controlsAttr, "");
    m_mediaElement->setAttribute(autoplayAttr, "");

#if PLATFORM(BLACKBERRY) && OS(QNX)
    Frame* frameForWidth = document()->frame();
    if (!frameForWidth)
        return;
    int layoutWidth = frameForWidth->view()->layoutWidth();
    char elementWidthAttr[12];
    sprintf(elementWidthAttr, "%d", layoutWidth*3/4); // Make the default width 3/4 of the frame width.
    m_mediaElement->setAttribute(widthAttr, elementWidthAttr);
    m_mediaElement->setNeedsSourceWidthUpdate(); // So we know to update the element width if we're playing a video and the size comes in with the metadata.
#else
    m_mediaElement->setAttribute(styleAttr, "margin: auto; position: absolute; top: 0; right: 0; bottom: 0; left: 0;");
#endif

    m_mediaElement->setAttribute(nameAttr, "media");
    m_mediaElement->setSrc(document()->url());

#if PLATFORM(BLACKBERRY) && OS(QNX)
    div->appendChild(mediaElement, ec);
#else
    body->appendChild(mediaElement, ec);
#endif

    Frame* frame = document()->frame();
    if (!frame)
        return;

    frame->loader()->activeDocumentLoader()->mainResourceLoader()->setShouldBufferData(false);
}
开发者ID:,项目名称:,代码行数:65,代码来源:


注:本文中的HTMLMediaElement::setSrc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。