Skip to content

Commit

Permalink
fix audio-transcoding for iOS v10 and older
Browse files Browse the repository at this point in the history
opus-in-caf was added in iOS v11;
use caf in iOS v12 and newer (iPhone 5s, iPad Air/mini2, iPod 6),
use mp3 in iOS v11 and older (iPhone 5c, iPad 4)
  • Loading branch information
9001 committed Jan 24, 2025
1 parent 40a1c71 commit c9eba39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions copyparty/web/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ var mpl = (function () {
if (!c)
return url;

return addq(url, 'th=' + (can_ogg ? 'opus' : (IPHONE || MACOS) ? 'caf' : 'mp3'));
return addq(url, 'th=' + (can_ogg ? 'opus' : can_caf ? 'caf' : 'mp3'));
};

r.pp = function () {
Expand Down Expand Up @@ -2493,7 +2493,8 @@ var mpl = (function () {
})();


var can_ogg = true;
var can_ogg = true,
can_caf = (IPHONE || MACOS) && !/ OS ([1-9]|1[01])_/.test(UA);
try {
can_ogg = new Audio().canPlayType('audio/ogg; codecs=opus') === 'probably';
}
Expand Down

0 comments on commit c9eba39

Please sign in to comment.