Skip to content

Commit 4314ea8

Browse files
committed
application: remove mkv from known media types
I was under the impression that MKV files played fine when an mp4 content-type was set, this appears to be wrong. Removed mkv from known media types, so now any mkv files will automatically transcode to mp4. Fixes #17
1 parent 280d897 commit 4314ea8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

application/application.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ func (a *Application) possibleContentType(filename string) (string, error) {
410410

411411
// https://developers.google.com/cast/docs/media
412412
switch ext := path.Ext(filename); ext {
413-
case ".mkv", ".mp4", ".m4a", ".m4p", ".MP4":
413+
case ".mp4", ".m4a", ".m4p", ".MP4":
414414
return "video/mp4", nil
415415
case ".webm":
416416
return "video/webm", nil
@@ -566,9 +566,15 @@ func (a *Application) loadAndServeFiles(filenames []string, contentType string,
566566
}
567567

568568
// Set the content-type
569+
// This assumes that a conten-type was passed through, and that it
570+
// doesn't need to be transcoded. This is for media files without
571+
// file extensions.
572+
// TODO: Is this correct behaviour?
569573
if contentType != "" {
570574
transcode = false
571575
} else if knownFileType {
576+
// If this is a media file we know the chromecast can play,
577+
// then we don't need to transcode it.
572578
contentType, _ = a.possibleContentType(filename)
573579
transcode = false
574580
} else if transcode {

todo.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- exponential retry for getting the cast application if it fails
1+
- Control volume via command line; +10%, -10% or set a value between 0-99.
2+
- Is it possible to support subtitles.

0 commit comments

Comments
 (0)