From 6ed7ad5d5d64adf7eabeca37eefd5dd03c986312 Mon Sep 17 00:00:00 2001 From: aidewoode Date: Wed, 8 May 2024 15:44:43 +0800 Subject: [PATCH] Make the transcoding condition more precise --- app/controllers/application_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d9bdb34a..7ff67c3e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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)