mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
Move supported MIME types into file-level const
This commit is contained in:
parent
0bf006b7d7
commit
4ab3abaa14
1 changed files with 9 additions and 9 deletions
|
@ -15,6 +15,15 @@ import { appendQuery, query } from '@/misc/prelude/url.js';
|
||||||
import { LoggerService } from "@/core/LoggerService.js";
|
import { LoggerService } from "@/core/LoggerService.js";
|
||||||
import type Logger from "@/logger.js";
|
import type Logger from "@/logger.js";
|
||||||
|
|
||||||
|
// faststart is only supported for MP4, M4A, M4W and MOV files (the MOV family).
|
||||||
|
// WebM (and Matroska) files always support faststart-like behavior.
|
||||||
|
const supportedMimeTypes = new Map([
|
||||||
|
['video/mp4', 'mp4'],
|
||||||
|
['video/m4a', 'mp4'],
|
||||||
|
['video/m4v', 'mp4'],
|
||||||
|
['video/quicktime', 'mov'],
|
||||||
|
]);
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class VideoProcessingService {
|
export class VideoProcessingService {
|
||||||
private logger: Logger;
|
private logger: Logger;
|
||||||
|
@ -78,15 +87,6 @@ export class VideoProcessingService {
|
||||||
*/
|
*/
|
||||||
@bindThis
|
@bindThis
|
||||||
public async webOptimizeVideo(source: string, mimeType: string): Promise<void> {
|
public async webOptimizeVideo(source: string, mimeType: string): Promise<void> {
|
||||||
// faststart is only supported for MP4, M4A, M4W and MOV files (the MOV family).
|
|
||||||
// WebM (and Matroska) files always support faststart-like behavior.
|
|
||||||
const supportedMimeTypes = new Map([
|
|
||||||
['video/mp4', 'mp4'],
|
|
||||||
['video/m4a', 'mp4'],
|
|
||||||
['video/m4v', 'mp4'],
|
|
||||||
['video/quicktime', 'mov']
|
|
||||||
]);
|
|
||||||
|
|
||||||
const outputFormat = supportedMimeTypes.get(mimeType);
|
const outputFormat = supportedMimeTypes.get(mimeType);
|
||||||
if (!outputFormat) {
|
if (!outputFormat) {
|
||||||
this.logger.debug(`Skipping web optimization for unsupported MIME type: ${mimeType}`);
|
this.logger.debug(`Skipping web optimization for unsupported MIME type: ${mimeType}`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue