Skip to content

Commit

Permalink
Make the transcoding condition more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
aidewoode committed May 8, 2024
1 parent ce26e22 commit 6ed7ad5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ class ApplicationController < ActionController::Base
def need_transcode?(song)
song_format = song.format

return true if !browser.safari? && !song_format.in?(Stream::WEB_SUPPORTED_FORMATS)
# Non-Safari browsers don't support ALAC format. So we need to transcode it.
return true if !browser.safari? && song_format == "m4a" && song.lossless?
return true if browser.safari? && !song_format.in?(Stream::SAFARI_SUPPORTED_FORMATS)
unless native_app?
return true if !browser.safari? && !song_format.in?(Stream::WEB_SUPPORTED_FORMATS)
# Non-Safari browsers don't support ALAC format. So we need to transcode it.
return true if !browser.safari? && song_format == "m4a" && song.lossless?
return true if browser.safari? && !song_format.in?(Stream::SAFARI_SUPPORTED_FORMATS)
end

return true if ios_app? && !song_format.in?(Stream::IOS_SUPPORTED_FORMATS)
return true if android_app? && !song_format.in?(Stream::ANDROID_SUPPORTED_FORMATS)

Expand Down

0 comments on commit 6ed7ad5

Please sign in to comment.