你如何使用YouTube的HTML5的iframe API设置的wmode =不透明? [英] How do you set wmode=opaque using Youtube's HTML5 iframe API?

查看:804
本文介绍了你如何使用YouTube的HTML5的iframe API设置的wmode =不透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过使用JavaScript API嵌入在一个网站的Youtube的HTML5实验IFRAME功能:

I'm embedding Youtube's experimental HTML5 iframe capabilities in a website through use of the javascript API:

YouTube播放器API参考< ifram>嵌入

我知道的z-index的问题,这带来了,这包括添加的wmode修复=不透明(或=的wmode透明)到iframe网址:

I'm aware of the z-index issues this brings about, and the fix that involves adding wmode=opaque (or wmode=transparent) to the iframe url:

固定。我的YouTube的iframe的z-index被忽略,是一个固定的div

在刚刚使用JavaScript API,你怎么设置的wmode为不透明的:

When just using the javascript API, how do you set wmode to opaque:

function onYouTubePlayerAPIReady() {
    var player;
    player = new YT.Player('player', {
        width: 1280,
        height: 720,
        videoId: 'u1zgFlCw8Aw',
        // if I try adding wmode: opaque here, it breaks
        playerVars: {
            controls: 0,
            showinfo: 0 ,
            modestbranding: 1
            // if I try adding wmode: opaque as a playerVar here, it breaks
        },
        events: {
            'onReady': onPlayerReady,
            'onPlaybackQualityChange': onPlayerPlaybackQualityChange
        }
    });
 }

任何想法?

推荐答案

嗯...

哦,看来我是在张贴问题草率。看来,在API中设置的wmode正确的形式是:

Well, it appears I was hasty in posting the question. It appears that the correct form for setting wmode within the API is:

function onYouTubePlayerAPIReady() {
    var player;
    player = new YT.Player('player', {
        width: 1280,
        height: 720,
        videoId: 'u1zgFlCw8Aw',
        playerVars: {
            controls: 0,
            showinfo: 0 ,
            modestbranding: 1,
            wmode: "opaque"
        },
        events: {
            'onReady': onPlayerReady,
            'onPlaybackQualityChange': onPlayerPlaybackQualityChange
        }
    });
 }

希望这可以帮助其他人。

Hopefully this helps someone else.

这篇关于你如何使用YouTube的HTML5的iframe API设置的wmode =不透明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆