Code Monkey home page Code Monkey logo

Comments (11)

zhw2590582 avatar zhw2590582 commented on June 4, 2024

手动调用动画帧是什么意思,老机型用不了很正常,毕竟用了WebAssembly

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

我看源码中是在decoder/index.js 中调用的animationFrame 我想使用pixi渲染它, 我是不是需要在pixi的animationFrame 中去调用 使用同一个GL上下文 ? , 我前端是半路出家的,之前做游戏的,有些地方不是很懂 抱歉哈~

from flvplayer.

zhw2590582 avatar zhw2590582 commented on June 4, 2024

Pixi是什么,还是不明白你的应用场景

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

不好意思 , 是我没有讲清楚. 我在使用一个2d webGL 渲染库 因为我看到flvPlayer 也是渲染在canvas上的 , 这样我的主页面 就有两个canvas了, 我希望可以在一个canvas中渲染 例如 将flvPlayer的画面渲染到一张sprite上, 这样我在打开关闭player并且做一些打开或者关闭的动画可能比较方便(我不太熟系直接去操作dom..) ~ 所以 , 我想要使用其他的渲染库去渲染flvPlayer~

from flvplayer.

zhw2590582 avatar zhw2590582 commented on June 4, 2024

你应该是想把现有的canvas传入到flvPlayer吧,你可以把你的canvas当成参数传进来,如:

var flv = new FlvPlayer({
    canvas: document.querySelector('canvas'),
});

然后修改一下/src/player/template.js,如:

export default function template(flv, player) {
    const { options } = flv;
    const cacheCss = options.container.style.cssText;
    options.container.classList.add('flvplayer-container');

    options.container.innerHTML = `<div class="flvplayer-player"></div>`;

    flv.on('destroy', () => {
        options.container.innerHTML = '';
        options.container.style.cssText = cacheCss;
        options.container.classList.remove('flvplayer-container');
    });

    Object.defineProperty(player, '$container', {
        value: options.container,
    });

    Object.defineProperty(player, '$player', {
        value: options.container.querySelector('.flvplayer-player'),
    });

    Object.defineProperty(player, '$canvas', {
        value: options.canvas,
    });
}

不过这样做的话,你就没办法使用flvplayer-control.js

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

好的 谢谢您 我是试一下~

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

您好 , 不好意思还有还有个问题想请教一下~.. 在长时间直播播放时
image,内存显示在缓慢增长 , 如果我将浏览器 切换至后台时,很快内存就会增长至1g左右 直到浏览器崩溃 . 另外 直播的话 可以快进吗? 有的时候 在一些无意的操作下 会导致视频直播有一些延迟~ 我想吧视频快进一下,让直播尽量比较比较时时~ 感谢~

from flvplayer.

zhw2590582 avatar zhw2590582 commented on June 4, 2024

内存过大问题已经尽力了,或者你可以把视频分辨率调低些。直播是不能快进的,至于解决方法可能我要优化一下代码才能有。

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

嗯呢 好的~ 谢谢您了~ 另外 您可以 在源码上加入自定义渲染吗?
image 这是我在您的源码加的测试代码 , 这样直接使用您解码库的数据, 如果使用了其他的 webgl 库的话~ 只需要在使用的地方写一些gl代码就以当做插件使用 ~ 并且一个canvas渲染~ 我在一台16年的华为上测试单canvas比双canvas帧率提升了20帧左右~ 在使用第三发渲染库的情况下基本可以保持60FPS,也可以直接传出yuv-buffer~ (这样我就可以偷懒~在更新您的库以后,就不用再去改代码了 ~ 23333)

from flvplayer.

zhw2590582 avatar zhw2590582 commented on June 4, 2024

这样会把参数复杂化,而且一般人也不会知道渲染器怎么构造。这个库将来也不会有大改动,所以建议你在这基础上直接修改更适合。

from flvplayer.

AegeanRagdolls avatar AegeanRagdolls commented on June 4, 2024

好的~ 谢谢您~

from flvplayer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.