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


C++ HTMLVideoElement类代码示例

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


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

示例1: body

void MediaDocument::replaceMediaElementTimerFired(Timer<MediaDocument>*)
{
    HTMLElement* htmlBody = body();
    if (!htmlBody)
        return;

    // Set body margin width and height to 0 as that is what a PluginDocument uses.
    htmlBody->setAttribute(marginwidthAttr, "0");
    htmlBody->setAttribute(marginheightAttr, "0");

    RefPtr<NodeList> nodeList = htmlBody->getElementsByTagName("video");

    if (nodeList.get()->length() > 0) {
        HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(nodeList.get()->item(0));

        RefPtr<Element> element = Document::createElement(embedTag, false);
        HTMLEmbedElement* embedElement = static_cast<HTMLEmbedElement*>(element.get());

        embedElement->setAttribute(widthAttr, "100%");
        embedElement->setAttribute(heightAttr, "100%");
        embedElement->setAttribute(nameAttr, "plugin");
        embedElement->setAttribute(srcAttr, url().string());
        embedElement->setAttribute(typeAttr, frame()->loader()->writer()->mimeType());

        ExceptionCode ec;
        videoElement->parent()->replaceChild(embedElement, videoElement, ec);
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: Q_ASSERT

void FullScreenVideoQt::exitFullScreenForNode(Node* node)
{
    Q_ASSERT(node);

#if USE(QT_MULTIMEDIA)
    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
    PlatformMedia platformMedia = videoElement->platformMedia();

    ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
        return;

    Q_ASSERT(m_FullScreenVideoHandler);

    if (!m_FullScreenVideoHandler)
        return;

    m_FullScreenVideoHandler->exitFullScreen();
    MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer();
    mediaPlayerQt->restoreVideoItem();
#endif
#if USE(GSTREAMER)
    m_FullScreenVideoHandlerGStreamer->exitFullScreen();
#endif

#if USE(QTKIT)
    m_FullScreenVideoHandlerQTKit->exitFullScreen();
#endif

}
开发者ID:13W,项目名称:phantomjs,代码行数:30,代码来源:FullScreenVideoQt.cpp

示例3: jsHTMLVideoElementPoster

JSValue jsHTMLVideoElementPoster(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    JSHTMLVideoElement* castedThis = static_cast<JSHTMLVideoElement*>(asObject(slot.slotBase()));
    UNUSED_PARAM(exec);
    HTMLVideoElement* imp = static_cast<HTMLVideoElement*>(castedThis->impl());
    return jsString(exec, imp->poster());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:7,代码来源:JSHTMLVideoElement.cpp

示例4: heightAttrSetter

static void heightAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    HTMLVideoElement* imp = V8HTMLVideoElement::toNative(info.Holder());
    unsigned v = toUInt32(value);
    imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::heightAttr, v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8HTMLVideoElement.cpp

示例5: HTMLVideoElement

HTMLVideoElement* HTMLVideoElement::create(Document& document)
{
    HTMLVideoElement* video = new HTMLVideoElement(document);
    video->ensureUserAgentShadowRoot();
    video->suspendIfNeeded();
    return video;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: ENABLE

QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrameAdapter* adapter, const QString& elementId)
{
    QUrl res;

#if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
    Frame* coreFrame = adapter->frame;
    if (!coreFrame)
        return res;

    Document* doc = coreFrame->document();
    if (!doc)
        return res;

    Node* coreNode = doc->getElementById(elementId);
    if (!coreNode)
        return res;

    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(coreNode);
    PlatformMedia platformMedia = videoElement->platformMedia();
    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
        return res;

    MediaPlayerPrivateQt* mediaPlayerQt = static_cast<MediaPlayerPrivateQt*>(platformMedia.media.qtMediaPlayer);
    if (mediaPlayerQt && mediaPlayerQt->mediaPlayer())
        res = mediaPlayerQt->mediaPlayer()->media().canonicalUrl();
#endif

    return res;
}
开发者ID:jbat100,项目名称:webkit,代码行数:29,代码来源:DumpRenderTreeSupportQt.cpp

示例7: videoElement

LayoutSize RenderVideo::calculateIntrinsicSize()
{
    HTMLVideoElement* video = videoElement();

    // Spec text from 4.8.6
    //
    // The intrinsic width of a video element's playback area is the intrinsic width
    // of the video resource, if that is available; otherwise it is the intrinsic
    // width of the poster frame, if that is available; otherwise it is 300 CSS pixels.
    //
    // The intrinsic height of a video element's playback area is the intrinsic height
    // of the video resource, if that is available; otherwise it is the intrinsic
    // height of the poster frame, if that is available; otherwise it is 150 CSS pixels.
    MediaPlayer* player = mediaElement()->player();
    if (player && video->readyState() >= HTMLVideoElement::HAVE_METADATA) {
        LayoutSize size = player->naturalSize();
        if (!size.isEmpty())
            return size;
    }

    if (video->shouldDisplayPosterImage() && !m_cachedImageSize.isEmpty() && !imageResource()->errorOccurred())
        return m_cachedImageSize;

    // <video> in standalone media documents should not use the default 300x150
    // size since they also have audio-only files. By setting the intrinsic
    // size to 300x1 the video will resize itself in these cases, and audio will
    // have the correct height (it needs to be > 0 for controls to render properly).
    if (video->ownerDocument() && video->ownerDocument()->isMediaDocument())
        return LayoutSize(defaultSize().width(), 1);

    return defaultSize();
}
开发者ID:Metrological,项目名称:chromium,代码行数:32,代码来源:RenderVideo.cpp

示例8: ASSERT_ARG

void FullscreenVideoController::LayerClient::platformCALayerLayoutSublayersOfLayer(PlatformCALayer* layer) 
{
    ASSERT_ARG(layer, layer == m_parent->m_rootChild);

    HTMLVideoElement* videoElement = m_parent->m_videoElement.get();
    if (!videoElement)
        return;


    PlatformCALayer* videoLayer = PlatformCALayer::platformCALayer(videoElement->platformLayer());
    if (!videoLayer || videoLayer->superlayer() != layer)
        return;

    FloatRect layerBounds = layer->bounds();

    FloatSize videoSize = videoElement->player()->naturalSize();
    float scaleFactor;
    if (videoSize.aspectRatio() > layerBounds.size().aspectRatio())
        scaleFactor = layerBounds.width() / videoSize.width();
    else
        scaleFactor = layerBounds.height() / videoSize.height();
    videoSize.scale(scaleFactor);

    // Calculate the centered position based on the videoBounds and layerBounds:
    FloatPoint videoPosition;
    FloatPoint videoOrigin;
    videoOrigin.setX((layerBounds.width() - videoSize.width()) * 0.5);
    videoOrigin.setY((layerBounds.height() - videoSize.height()) * 0.5);
    videoLayer->setPosition(videoOrigin);
    videoLayer->setBounds(FloatRect(FloatPoint(), videoSize));
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:31,代码来源:FullscreenVideoController.cpp

示例9: shouldAppendLayer

static bool shouldAppendLayer(const PaintLayer& layer)
{
    Node* node = layer.layoutObject()->node();
    if (node && isHTMLVideoElement(*node)) {
        HTMLVideoElement* element = toHTMLVideoElement(node);
        if (element->isFullscreen() && element->usesOverlayFullscreenVideo())
            return false;
    }
    return true;
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:10,代码来源:GraphicsLayerTreeBuilder.cpp

示例10: descendentVideoElement

void MediaDocument::defaultEventHandler(Event* event)
{
    // Match the default Quicktime plugin behavior to allow 
    // clicking and double-clicking to pause and play the media.
    Node* targetNode = event->target()->toNode();
    if (!targetNode)
        return;

    HTMLVideoElement* video = descendentVideoElement(targetNode);
    if (!video)
        return;

    if (event->type() == eventNames().clickEvent) {
        if (!video->canPlay()) {
            video->pause(event->fromUserGesture());
            event->setDefaultHandled();
        }
    } else if (event->type() == eventNames().dblclickEvent) {
        if (video->canPlay()) {
            video->play(event->fromUserGesture());
            event->setDefaultHandled();
        }
    } else if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
        KeyboardEvent* keyboardEvent = static_cast<KeyboardEvent*>(event);
        if (keyboardEvent->keyIdentifier() == "U+0020") { // space
            if (video->paused()) {
                if (video->canPlay())
                    video->play(event->fromUserGesture());
            } else
                video->pause(event->fromUserGesture());
            event->setDefaultHandled();
        }
    }
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:34,代码来源:MediaDocument.cpp

示例11: ENABLE

void HitTestResult::enterFullscreenForVideo() const
{
#if ENABLE(VIDEO)
    HTMLMediaElement* mediaElt(mediaElement());
    if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
        HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
        if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen())
            videoElt->enterFullscreen();
    }
#endif
}
开发者ID:dzhshf,项目名称:WebKit,代码行数:11,代码来源:HitTestResult.cpp

示例12: ENABLE

void HitTestResult::enterFullscreenForVideo() const
{
#if ENABLE(VIDEO)
    HTMLMediaElement* mediaElt(mediaElement());
    if (mediaElt && isHTMLVideoElement(mediaElt)) {
        HTMLVideoElement* videoElt = toHTMLVideoElement(mediaElt);
        if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen()) {
            UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
            videoElt->enterFullscreen();
        }
    }
#endif
}
开发者ID:webOS-ports,项目名称:webkit,代码行数:13,代码来源:HitTestResult.cpp

示例13: ENABLE

void HitTestResult::enterFullscreenForVideo() const
{
#if ENABLE(VIDEO)
    HTMLMediaElement* mediaElt(mediaElement());
    if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
        HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
        if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen()) {
            UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
            videoElt->enterFullscreen();
        }
    }
#endif
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例14: webkitEnterFullScreenCallback

static v8::Handle<v8::Value> webkitEnterFullScreenCallback(const v8::Arguments& args)
{
    HTMLVideoElement* imp = V8HTMLVideoElement::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    imp->webkitEnterFullScreen(ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:13,代码来源:V8HTMLVideoElement.cpp

示例15: OS

void MediaDocument::defaultEventHandler(Event* event)
{
#if !(PLATFORM(BLACKBERRY) && OS(QNX))
    // Match the default Quicktime plugin behavior to allow 
    // clicking and double-clicking to pause and play the media.
    Node* targetNode = event->target()->toNode();
    if (targetNode && targetNode->hasTagName(videoTag)) {
        HTMLVideoElement* video = static_cast<HTMLVideoElement*>(targetNode);
        if (event->type() == eventNames().clickEvent) {
            if (!video->canPlay()) {
                video->pause(event->fromUserGesture());
                event->setDefaultHandled();
            }
        } else if (event->type() == eventNames().dblclickEvent) {
            if (video->canPlay()) {
                video->play(event->fromUserGesture());
                event->setDefaultHandled();
            }
        }
    }

    if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
        HTMLVideoElement* video = 0;
        if (targetNode) {
            if (targetNode->hasTagName(videoTag))
                video = static_cast<HTMLVideoElement*>(targetNode);
            else {
                RefPtr<NodeList> nodeList = targetNode->getElementsByTagName("video");
                if (nodeList.get()->length() > 0)
                    video = static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
            }
        }
        if (video) {
            KeyboardEvent* keyboardEvent = static_cast<KeyboardEvent*>(event);
            if (keyboardEvent->keyIdentifier() == "U+0020") { // space
                if (video->paused()) {
                    if (video->canPlay())
                        video->play(event->fromUserGesture());
                } else
                    video->pause(event->fromUserGesture());
                event->setDefaultHandled();
            }
        }
    }
#endif
}
开发者ID:,项目名称:,代码行数:46,代码来源:


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