Skip to content

Commit ff8043d

Browse files
authored
Merge pull request #377 from blackcandy-org/alac-transcode
Transcode ALAC format for non-safari browsers
2 parents d35775f + 6ed7ad5 commit ff8043d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/controllers/application_controller.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ class ApplicationController < ActionController::Base
4444
def need_transcode?(song)
4545
song_format = song.format
4646

47-
return true unless song_format.in?(Stream::WEB_SUPPORTED_FORMATS)
48-
return true if browser.safari? && !song_format.in?(Stream::SAFARI_SUPPORTED_FORMATS)
47+
unless native_app?
48+
return true if !browser.safari? && !song_format.in?(Stream::WEB_SUPPORTED_FORMATS)
49+
# Non-Safari browsers don't support ALAC format. So we need to transcode it.
50+
return true if !browser.safari? && song_format == "m4a" && song.lossless?
51+
return true if browser.safari? && !song_format.in?(Stream::SAFARI_SUPPORTED_FORMATS)
52+
end
53+
4954
return true if ios_app? && !song_format.in?(Stream::IOS_SUPPORTED_FORMATS)
5055
return true if android_app? && !song_format.in?(Stream::ANDROID_SUPPORTED_FORMATS)
5156

0 commit comments

Comments
 (0)