videoplayer如何设置层级

如题,在scene中添加videoplayer控件,怎么动态设置它的层级,谢谢

zindx等于-1

不起作用啊,还是在最上层,能否在运行中动态改变videoplayer和node的层级关系?

还要改一个透明度值

_audioPlayer->setLocalZOrder(-1) 是这样方法吗 ?

  • 引擎目录 engine/bin/cocos2d-js-for-preview.js 在 _createDom 方法中,添加

video.style.zIndex = -1

_createDom: function _createDom(muted) { var video = document.createElement("video"); video.style.position = "absolute"; video.style.bottom = "0px"; video.style.left = "0px"; video.className = "cocosVideo"; video.setAttribute("preload", "auto"); video.setAttribute("webkit-playsinline", ""); video.setAttribute("x5-playsinline", ""); video.setAttribute("playsinline", ""); video.style.zIndex = -1; muted && video.setAttribute("muted", ""); this._video = video; cc.game.container.appendChild(video); },

  • static/preview-templates/boot.js 在 cc.game.run 之前添加
  • cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
    安卓mask 变白问题
    • glSurfaceView.setEGLConfigChooser 设置的值需要修改为 (8,8,8,8,24,8),目前官方设置的是8,8,8,8,0,0,0

两个地方,你好好看下

这个就是在相关配置的时候videoplayer的层级固定了,要么在最上层要么在最下层,是吗?能在项目运行中动态改变它在最上层或最下层吗?

比方说我在一个页面是在最上层,在另外一个界面是在最下层

原生的话我们自己写的,web没搞

好的,谢谢

web上,videoplayer 放在下层 mask 挖个洞 勉强可以达到要求