-
Notifications
You must be signed in to change notification settings - Fork 165
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
Performance hit for media over 1 hour #150
Comments
Thanks @Laurian , thought you had come across this before on that project. posting code here as we haven't got around open sourcing the other project just yet. import VisibilitySensor from 'react-visibility-sensor';
...
return (
<div className="WrapperBlock">
<VisibilitySensor intervalCheck={false} scrollCheck>
{
({ isVisible }) =>
(
<div>{isVisible ? (
<TimecodeBlock
start={start}
min={min}
max={max}
end={end}
id={id}
retime={(time, tcStart, tcEnd) => this.props.blockProps.retime(time, key, tcStart, tcEnd)}
focus={focus => this.props.blockProps.focus(focus)}
/>
) : <span>…</span>}
</div>
)
}
</VisibilitySensor>
<EditorBlock {...this.props} />
</div>
);
ok, ok great thanks! going to try out |
@Laurian I've added it return (
<div className={ style.WrapperBlock }>
<VisibilitySensor intervalCheck={ false } scrollCheck>
{
({ isVisible }) =>
(
<div>
{ isVisible ? (
<div className={ [ style.markers, style.unselectable ].join(' ') }
contentEditable={ false }>
{this.props.blockProps.showSpeakers ? speakerElement : ''}
{this.props.blockProps.showTimecodes ? timecodeElement : ''}
</div>
) : <span>…</span> }
</div>
)
}
</VisibilitySensor>
<div className={ style.text }>
<EditorBlock { ...this.props } />
</div>
</div>
); made a branch performance is the same, and also the I remember there was an issue around, the |
Is there any update on this issue, we are using this module in our application and also facing a noticeable lag between typed text and reflecting it on the screen. This behaviour is mostly for the large size audio files. |
Hi @jkokatnur And see the last comment in the PR about "paginating" draftJs content, as is something that might be worth exploring as separate branch/PR #160 (comment) Btw, did you notice what's the duration of audio after which you start to get performance issues? Do Let us know if you have any thoughts or suggestions on how to tackle this. |
Test update despite this issue Automattic/simplenote-electron#501 (comment) I've tried with text that has 22 763 words corrsponding to 2h42min.txt copy pasting in draftjs.org demo (so without entities) and it seems like it is editable just fine.. However if you try and copy paste the whole of the Moby Dick book - 215 821 words then it struggles. |
This kinda works, needs more testing but it feels the right direction: Laurian@63924f2#diff-cdf6a9957d22ff2efacaaf5fb2876a8aL111-L114 Basically if a block is off-screen render a read-only lighter DOM version of it (just text no entities) |
hmm, yeah the treatment of the EditorBlock is as in PR #181, wasn't that working for you? |
Wasn't working, when correcting text there was still a significant lag. But at this point not 100% sure what exactly is causing it? |
I'm also having this performance issue on a 24M wav file (approx 25 minutes). The rendered draftJs file is 2.4M. I've noticed Google Chrome spiking at 90% while playing, causing various actions to take place in different orders from my user actions. I think all of the issues reported today are due to the latency problem. |
via @Laurian https://www.chromestatus.com/feature/4613920211861504
|
Also having same problem. video is over an hour and sometimes even page crashes due to heavy load. |
ok this worked for me.. no lag at all. let containmentDOMRect = document.querySelector(".notranslate");
return (
containmentDOMRect ? (
<VisibilitySensor partialVisibility={true} onChange={this.visibilityChanged} containment={containmentDOMRect} intervalCheck={ false } scrollCheck>
{({isVisible}) => isVisible ?
<div className={ style.WrapperBlock }>
<div
className={ [ style.markers, style.unselectable ].join(' ') }
contentEditable={ false }
>
{this.props.blockProps.showSpeakers ? speakerElement : ''}
{this.props.blockProps.showTimecodes ? timecodeElement : ''}
</div>
<div className={ style.text }>
<EditorBlock { ...this.props } />
</div>
</div> : <span className={ style.loadingBlockPlaceholder }>loading...</span>
}
</VisibilitySensor>
):null
); |
That's awesome thanks @aneesijaz !! will try it out as soon as I get a chance! |
re let containmentDOMRect = document.querySelector(".notranslate"); @aneesijaz where do you get the |
That's the css selector for the div holding all the wrapperBlocks (may be generated by draft.js). |
Stating the obvious, if you indulge me for a sec, re content editable vs textarea. Took one hour worth of video, copy pasted twice, so that would be equivalent to two hours worth of text transcription. Put a text area along side a content editable div. (did this in this other app coz I was already using a play content editable area there - without draftJs) As you can see editing text in text area is snappy, even deleting, while there is substantial lag in content editable (on the right). I know that DraftJs constrains content editable to make it more efficient. But none the less is still build on top of it under the hood, so there might be some limitations that are to do with the dom, the browser, and content editable behaviour when it's content is too large, requiring repainting etc.. Other thought is that we might not need the rich text editing experience traditional of content editable and draftJS and if we park the highlighting words while playing feature for a second. Exploring So the idea is, could we do a I guess another issue would be how to display paragraphs/speakers?
|
Following @Laurian 's advised and before |
isEditable={true} but i can not edit text in browser?! |
Describe the bug
There seems to be a noticeable performance hit for media over 1 hour - in this case 2h 42 min video.
To Reproduce
Prep - get a transcript for along file
these are the steps I followed, irrelevant for the bug itself, but helpful to setup problem, you can skip
Steps to reproduce the behavior:
This is the json I used
three-hours-sample.mp4_26_04_2019_15-12-51.json.zip
Expected behaviour
No lag for videos over 1 hour, same responsiveness as for video under 1 hour.
Screenshots
Desktop
@bbc/[email protected]
Additional context
Not sure what's the issue 🤷♂️
Might be mostly to do with draftjs?
facebookarchive/draft-js#437
facebookarchive/draft-js#117
https://reactrocket.com/post/draft-js-best-practices/
The text was updated successfully, but these errors were encountered: