Skip to content

Commit

Permalink
[highlighter] improve export flo (#5266)
Browse files Browse the repository at this point in the history
* replaced custom with sl loader

* show export progress quicker

* remove wrong margin

---------

Co-authored-by: Micheline Wu <[email protected]>
  • Loading branch information
marvinoffers and michelinewu authored Jan 15, 2025
1 parent d134eec commit ebdd5ed
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 35 deletions.
18 changes: 0 additions & 18 deletions app/components-react/highlighter/StreamCard.m.less
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,6 @@
z-index: 1;
}

.loader {
border: 2px solid #f3f3f3; /* Light grey */
border-top: 2px solid #3e3e3e; /* Blue */
border-radius: 50%;
width: 16px;
height: 16px;
animation: spin 2s linear infinite;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

.delete-button {
display: flex;
top: 8px;
Expand Down
30 changes: 19 additions & 11 deletions app/components-react/highlighter/StreamCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,29 @@ function ActionBar({
<Button
size="large"
type="primary"
icon={
clipsOfStreamAreLoading !== stream.id ? (
<i className="icon-download" style={{ marginRight: '4px' }} />
) : undefined
}
onClick={e => {
emitExportVideo();
e.stopPropagation();
}}
style={{ display: 'grid', gridTemplateAreas: 'stack' }}
>
{clipsOfStreamAreLoading === stream.id ? (
<div className={styles.loader}></div>
) : (
<> {$t('Export highlight reel')}</>
)}
<div
style={{
visibility: clipsOfStreamAreLoading === stream.id ? 'visible' : 'hidden',
gridArea: 'stack',
}}
>
<i className="fa fa-spinner fa-pulse" />
</div>
<span
style={{
visibility: clipsOfStreamAreLoading !== stream.id ? 'visible' : 'hidden',
gridArea: 'stack',
}}
>
<i className="icon-download" style={{ marginRight: '4px' }} />
{$t('Export highlight reel')}
</span>
</Button>
</div>
);
Expand Down Expand Up @@ -255,7 +263,7 @@ export function Thumbnail({
}) {
function getThumbnailText(state: EAiDetectionState): JSX.Element | string {
if (clipsOfStreamAreLoading === stream?.id) {
return <div className={styles.loader}></div>;
return <i className="fa fa-spinner fa-pulse" />;
}

if (clips.length > 0) {
Expand Down
1 change: 1 addition & 0 deletions app/i18n/en-US/highlighter.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"Get highlights (Fortnite only)": "Get highlights (Fortnite only)",
"My Stream Highlights": "My Stream Highlights",
"You cannot use special characters in this field": "You cannot use special characters in this field",
"Please select at least one clip to export a video": "Please select at least one clip to export a video",
"Share feedback": "Share feedback",
"Select at least one clip to preview your video": "Select at least one clip to preview your video",
"Select at least one clip to export your video": "Select at least one clip to export your video"
Expand Down
18 changes: 12 additions & 6 deletions app/services/highlighter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,13 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
console.error('Highlighter: Cannot export until current export operation is finished');
return;
}

this.SET_EXPORT_INFO({
exporting: true,
currentFrame: 0,
step: EExportStep.AudioMix,
cancelRequested: false,
error: null,
});
let renderingClips: RenderingClip[] = [];
if (streamId) {
renderingClips = this.getClips(this.views.clips, streamId)
Expand Down Expand Up @@ -1411,6 +1417,11 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt

if (!renderingClips.length) {
console.error('Highlighter: Export called without any clips!');
this.SET_EXPORT_INFO({
exporting: false,
exported: false,
error: $t('Please select at least one clip to export a video'),
});
return;
}

Expand All @@ -1423,12 +1434,7 @@ export class HighlighterService extends PersistentStatefulService<IHighlighterSt
const totalFramesAfterTransitions = totalFrames - numTransitions * transitionFrames;

this.SET_EXPORT_INFO({
exporting: true,
currentFrame: 0,
totalFrames: totalFramesAfterTransitions,
step: EExportStep.AudioMix,
cancelRequested: false,
error: null,
});

let fader: AudioCrossfader | null = null;
Expand Down

0 comments on commit ebdd5ed

Please sign in to comment.