showNotification({icon:'info',text: i18n.t('The audio track is not supported while previewing. You can convert to a supported format from the menu')});
}elseif(!validDuration){
toast.fire({icon:'warning',timer: 10000,text: i18n.t('This file does not have a valid duration. This may cause issues. You can try to fix the file\'s duration from the File menu')});
getSwal().toast.fire({icon:'warning',timer: 10000,text: i18n.t('This file does not have a valid duration. This may cause issues. You can try to fix the file\'s duration from the File menu')});
}
// This needs to be last, because it triggers <video> to load the video
@ -2190,7 +2190,7 @@ function App() {
setWorking(undefined);
}
}elseif(error.code===PIPELINE_ERROR_READ){// file is not readable or was removed
toast.fire({icon:'error',timer: 10000,text: i18n.t('Failed to read file. Perhaps it has been moved?')});
getSwal().toast.fire({icon:'error',timer: 10000,text: i18n.t('Failed to read file. Perhaps it has been moved?')});
toast.fire({icon:'info',timer: 10000,text: i18n.t('Whether to preserve chapters from source file.')});
},[]);
showHelpText({text: i18n.t('Whether to preserve chapters from source file.')});
},[showHelpText]);
constonPreserveMovDataHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('Preserve all MOV/MP4 metadata tags (e.g. EXIF, GPS position etc.) from source file? Note that some players have trouble playing back files where all metadata is preserved, like iTunes and other Apple software')});
},[]);
showHelpText({text: i18n.t('Preserve all MOV/MP4 metadata tags (e.g. EXIF, GPS position etc.) from source file? Note that some players have trouble playing back files where all metadata is preserved, like iTunes and other Apple software')});
toast.fire({icon:'info',timer: 10000,text: i18n.t('Whether to preserve metadata from source file. Default: Global (file metadata), per-track and per-chapter metadata will be copied. Non-global: Only per-track and per-chapter metadata will be copied. None: No metadata will be copied')});
},[]);
showHelpText({text: i18n.t('Whether to preserve metadata from source file. Default: Global (file metadata), per-track and per-chapter metadata will be copied. Non-global: Only per-track and per-chapter metadata will be copied. None: No metadata will be copied')});
},[showHelpText]);
constonMovFastStartHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('Enabling this will allow faster playback of the exported file. This makes processing use 3 times as much export I/O, which is negligible for small files but might slow down exporting of large files.')});
},[]);
showHelpText({text: i18n.t('Enabling this will allow faster playback of the exported file. This makes processing use 3 times as much export I/O, which is negligible for small files but might slow down exporting of large files.')});
},[showHelpText]);
constonOutFmtHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('Defaults to same format as input file. You can losslessly change the file format (container) of the file with this option. Not all formats support all codecs. Matroska/MP4/MOV support the most common codecs. Sometimes it\'s even impossible to export to the same output format as input.')});
},[]);
showHelpText({text: i18n.t('Defaults to same format as input file. You can losslessly change the file format (container) of the file with this option. Not all formats support all codecs. Matroska/MP4/MOV support the most common codecs. Sometimes it\'s even impossible to export to the same output format as input.')});
},[showHelpText]);
constonKeyframeCutHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('With "keyframe cut", we will cut at the nearest keyframe before the desired start cutpoint. This is recommended for most files. With "Normal cut" you may have to manually set the cutpoint a few frames before the next keyframe to achieve a precise cut')});
},[]);
showHelpText({text: i18n.t('With "keyframe cut", we will cut at the nearest keyframe before the desired start cutpoint. This is recommended for most files. With "Normal cut" you may have to manually set the cutpoint a few frames before the next keyframe to achieve a precise cut')});
},[showHelpText]);
constonSmartCutHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('This experimental feature will re-encode the part of the video from the cutpoint until the next keyframe in order to attempt to make a 100% accurate cut. Only works on some files. I\'ve had success with some h264 files, and only a few h265 files. See more here: {{url}}',{url:'https://github.com/mifi/lossless-cut/issues/126'})});
},[]);
showHelpText({text: i18n.t('This experimental feature will re-encode the part of the video from the cutpoint until the next keyframe in order to attempt to make a 100% accurate cut. Only works on some files. I\'ve had success with some h264 files, and only a few h265 files. See more here: {{url}}',{url:'https://github.com/mifi/lossless-cut/issues/126'})});
},[showHelpText]);
constonTracksHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('Not all formats support all track types, and LosslessCut is unable to properly cut some track types, so you may have to sacrifice some tracks by disabling them in order to get correct result.')});
},[]);
showHelpText({text: i18n.t('Not all formats support all track types, and LosslessCut is unable to properly cut some track types, so you may have to sacrifice some tracks by disabling them in order to get correct result.')});
toast.fire({icon:'info',timer: 10000,text: i18n.t('When merging, do you want to create chapters in the merged file, according to the cut segments? NOTE: This may dramatically increase processing time')});
},[]);
showHelpText({text: i18n.t('When merging, do you want to create chapters in the merged file, according to the cut segments? NOTE: This may dramatically increase processing time')});
toast.fire({icon:'info',timer: 10000,text: i18n.t('When merging, do you want to preserve metadata from your original file? NOTE: This may dramatically increase processing time')});
},[]);
showHelpText({text: i18n.t('When merging, do you want to preserve metadata from your original file? NOTE: This may dramatically increase processing time')});
},[showHelpText]);
constonOutSegTemplateHelpPress=useCallback(()=>{
toast.fire({icon:'info',timer: 10000,text: i18n.t('You can customize the file name of the output segment(s) using special variables.',{count: segmentsToExport.length})});
},[segmentsToExport.length]);
showHelpText({text: i18n.t('You can customize the file name of the output segment(s) using special variables.',{count: segmentsToExport.length})});
toast.fire({icon:'info',timer: 10000,text: i18n.t('This option allows you to shift all segment start times forward by one or more frames before cutting. This can be useful if the output video starts from the wrong (preceding) keyframe.')});
},[]);
showHelpText({text: i18n.t('This option allows you to shift all segment start times forward by one or more frames before cutting. This can be useful if the output video starts from the wrong (preceding) keyframe.')});
constexample=i18n.t('YouTube video description\n00:00 Intro\n00:01 Chapter 2\n00:00:02.123 Chapter 3');
const{value}=await Swal.fire({
const{value}=awaitgetSwal().Swal.fire({
title: i18n.t('Import text chapters / YouTube'),
input:'textarea',
inputPlaceholder: example,
@ -85,10 +85,10 @@ export async function askForFileOpenAction(inputOptions: Record<string, string>)
letvalue;
functiononClick(key?: string){
value=key;
Swal.close();
getSwal().Swal.close();
}
constswal=ReactSwal.fire({
constswal=getSwal().Swal.fire({
html:(
<divstyle={{textAlign:'left'}}>
<divstyle={{marginBottom:'1em'}}>{i18n.t('You opened a new file. What do you want to do?')}</div>
@ -116,35 +116,35 @@ export async function askForFileOpenAction(inputOptions: Record<string, string>)
}
exportasyncfunctionshowDiskFull() {
await Swal.fire({
awaitgetSwal().Swal.fire({
icon:'error',
text: i18n.t('You ran out of space'),
});
}
exportasyncfunctionshowMuxNotSupported() {
await Swal.fire({
awaitgetSwal().Swal.fire({
icon:'error',
text: i18n.t('At least one codec is not supported by the selected output file format. Try another output format or try to disable one or more tracks.'),
});
}
exportasyncfunctionshowOutputNotWritable() {
await Swal.fire({
awaitgetSwal().Swal.fire({
icon:'error',
text: i18n.t('You are not allowed to write the output file. This probably means that the file already exists with the wrong permissions, or you don\'t have write permissions to the output folder.'),
});
}
exportasyncfunctionshowRefuseToOverwrite() {
await Swal.fire({
awaitgetSwal().Swal.fire({
icon:'warning',
text: i18n.t('Output file already exists, refusing to overwrite. You can turn on overwriting in settings.'),
});
}
exportasyncfunctionaskForImportChapters() {
const{isConfirmed}=await Swal.fire({
const{isConfirmed}=awaitgetSwal().Swal.fire({
icon:'question',
text: i18n.t('This file has embedded chapters. Do you want to import the chapters as cut-segments?'),
showCancelButton: true,
@ -158,7 +158,7 @@ export async function askForImportChapters() {
constmaxSegments=1000;
asyncfunctionaskForNumSegments() {
const{value}=await Swal.fire({
const{value}=awaitgetSwal().Swal.fire({
input:'number',
inputAttributes:{
min: String(0),
@ -195,7 +195,7 @@ export async function askForSegmentDuration({ totalDuration, inputPlaceholder, p
inputPlaceholder: string,
parseTimecode: ParseTimecode,
}){
const{value}=await Swal.fire({
const{value}=awaitgetSwal().Swal.fire({
input:'text',
showCancelButton: true,
inputValue: inputPlaceholder,
@ -233,7 +233,7 @@ async function askForSegmentsRandomDurationRange() {
return{durationMin,durationMax,gapMin,gapMax};
}
const{value}=await Swal.fire({
const{value}=awaitgetSwal().Swal.fire({
input:'text',
showCancelButton: true,
inputValue:'Duration 3 to 5, Gap 0 to 2',
@ -251,7 +251,7 @@ async function askForSegmentsRandomDurationRange() {
text:`Got ${err.code}. This probably means that anti-virus is blocking execution of ffmpeg. Please make sure the following file exists and is executable:\n\n${getFfmpegPath()}\n\nSee this issue: https://github.com/mifi/lossless-cut/issues/1114`,
// Because Apple is being nazi about the ability to open "copy protected DVD files"
if(isMasBuild){
toast.fire({icon:'error',text:'Unfortunately .vob files are not supported in the App Store version of LosslessCut due to Apple restrictions'});
getSwal().toast.fire({icon:'error',text:'Unfortunately .vob files are not supported in the App Store version of LosslessCut due to Apple restrictions'});