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

[highlighter] improve export flo #5266

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading