Skip to content

Commit

Permalink
use mp4 over webm (#3666)
Browse files Browse the repository at this point in the history
* use mp4 over webm

* tinymp4

* safari only
  • Loading branch information
haileyok authored Apr 23, 2024
1 parent 316fce6 commit 76aef2d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/lib/strings/embed-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,17 @@ export function parseEmbedPlayerFromUrl(

if (id && filename && dimensions && id.includes('AAAAC')) {
if (Platform.OS === 'web') {
id = id.replace('AAAAC', 'AAAP3')
filename = filename.replace('.gif', '.webm')
const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent,
)

if (isSafari) {
id = id.replace('AAAAC', 'AAAP1')
filename = filename.replace('.gif', '.mp4')
} else {
id = id.replace('AAAAC', 'AAAP3')
filename = filename.replace('.gif', '.webm')
}
} else {
id = id.replace('AAAAC', 'AAAAM')
}
Expand Down

0 comments on commit 76aef2d

Please sign in to comment.