Browse Source

fix(audio): add support for .opus files in audio duration calculation

CaIon 4 months ago
parent
commit
303feafc3c
1 changed files with 4 additions and 3 deletions
  1. 4 3
      common/audio.go

+ 4 - 3
common/audio.go

@@ -30,10 +30,11 @@ func GetAudioDuration(ctx context.Context, f io.ReadSeeker, ext string) (duratio
 		duration, err = getFLACDuration(f)
 	case ".m4a", ".mp4":
 		duration, err = getM4ADuration(f)
-	case ".ogg", ".oga":
+	case ".ogg", ".oga", ".opus":
 		duration, err = getOGGDuration(f)
-	case ".opus":
-		duration, err = getOpusDuration(f)
+		if err != nil {
+			duration, err = getOpusDuration(f)
+		}
 	case ".aiff", ".aif", ".aifc":
 		duration, err = getAIFFDuration(f)
 	case ".webm":