Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基于 FFmpeg 的 Cocos Creator 视频播放器 #21

Open
wzpan opened this issue Dec 31, 2020 · 1 comment
Open

基于 FFmpeg 的 Cocos Creator 视频播放器 #21

wzpan opened this issue Dec 31, 2020 · 1 comment

Comments

@wzpan
Copy link

wzpan commented Dec 31, 2020

https://oedx.github.io/2020/12/29/FFmpeg-Cocos-Creator/

只为解决一个核心问题,追求更好体验。 背景腾讯开心鼠项目使用的游戏引擎是 Cocos Creator,由于引擎提供的视频组件实现方式问题导致视频组件和游戏界面分了层,从而导致了以下若干问题: 不可以在视频组件上添加其他渲染组件; 不可以使用遮罩组件来限定视频形状; 退出场景时存在视频组件残影; 等等… 核心问题就是分层问题,对于开心鼠项目带来的最大弊端就是:一套设计,Android,iOS

@LittleZzUni
Copy link

// 在 Web 端,则是在 CCVideo 渲染组件的每一帧去传递 video 元素,代码如下:
let gl = cc.renderer.device._gl;
this.update = dt => {
    if(this._currentState == VideoState.PLAYING){
        gl.bindTexture(gl.TEXTURE_2D, this.texture._glID);
        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this.video);
    }
};

这里可以用下requestVideoFrameCallback这个api,再不支持的浏览器上在用上面的方案。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants