[Cin] UPD: Re: Video background on CinGG website eats CPU ...
Andrew Randrianasulu
randrianasulu at gmail.com
Sun Nov 3 01:25:21 CET 2019
В сообщении от Sunday 03 November 2019 00:49:14 Sam написал(а):
> Thanks for all the clues.
> For performance reasons I deactivated this effect video and replaced it
> with a simple image. I will try the previous effect elsewhere at a later
> time, with the right corrections. Currently the fast page loading is
> more important and a usable download page. With this change you should
> have no more problems with too high CPU usage.
>
> Sam
Thanks Sam, site works OK even on slowed down machine!
>
> On 02.11.19 15:47, Andrew Randrianasulu wrote:
> > Well, I hope Sam will find this info useful (myself is not a dev for adding this to webpage/locally):
> >
> > https://gist.github.com/cferdinandi/9044694
> > "simple method to stop YouTube, Vimeo, and HTML5 videos from playing."
> >
> > https://gomakethings.com/stopping-youtube-vimeo-and-html5-videos-with-javascript/
> > basically the same but without comments. sometimes comments useful .....
> >
> > /**
> > * Stop an iframe or HTML5 <video> from playing
> > * @param {Element} element The element that contains the video
> > */
> > var stopVideo = function ( element ) {
> > var iframe = element.querySelector( 'iframe');
> > var video = element.querySelector( 'video' );
> > if ( iframe ) {
> > var iframeSrc = iframe.src;
> > iframe.src = iframeSrc;
> > }
> > if ( video ) {
> > video.pause();
> > }
> > };
> >
> > --------------
> >
> > and further in comments
> >
> > ===========
> >
> > Copy link
> > Luminicus commented Sep 23, 2019
> > Good idea, but how can I call the function on click to pause all iframe > videos on the page (without ID of every iframe) ?
> > @cferdinandi
> > Copy link
> > Owner Author
> > cferdinandi commented Sep 24, 2019
> > @Luminicus This outta do it.
> > /**
> > * Stop all iframes or HTML5 <video>'s from playing
> > */
> > var stopVideos = function () {
> > var videos = document.querySelectorAll('iframe, video');
> > Array.prototype.forEach.call(videos, function (video) {
> > if (video.tagName.toLowerCase() === 'video') {
> > video.pause();
> > } else {
> > var src = video.src;
> > video.src = src;
> > }
> > });
> > };
> >
> > ============
> >
> > but may be you already figured this out. I usually check git, not website itself :}
> >
> > ---------- Пересланное сообщение ----------
> >
> > Тема: Re: [Cin] Video background on CinGG website eats CPU ...
> > Дата: Пятница 01 ноября 2019
> > Отправитель: Andrew Randrianasulu <randrianasulu at gmail.com>
> > Получатель: "Cinelerra.GG" <cin at lists.cinelerra-gg.org>
> >
> > В сообщении от Friday 01 November 2019 13:29:04 Andrea paz написал(а):
> >> Your information and tests are always interesting, thanks also for the
> >> link. I also noticed a great CPU usage watching the video of the site.
> >> In total, with "top", we are around 90%, of which 30-40% of GPUs that
> >> do not know what it means (I have enabled hardware acceleration in
> >> Firefox).
> > yes, I also have layers.acceleration.force-enabled enabled in Seamonkey, but this only accelerates in-browser compositing, IIRC
> >
> >> But I have the same results watching the same video on Youtube:
> >> https://www.youtube.com/watch?v=SzP2o2OJ90g
> >> And the same results from watching any video on Youtube.
> >> Does it turn out to you too?
> >
> > Yeah, 200%+ of CPU according to top :}
> >
> > Video in avc1 (h264), so may be Chrome (and/or Firefox on windows?) actually use
> > hw acceleration for *decoding* it, so effect not very notieceable ....
> >
> > https://bugzilla.mozilla.org/show_bug.cgi?id=1210727
> >
> > -------------------------------------------------------
More information about the Cin
mailing list