Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vunguyentuan/eab2f770786d824724ee8c00cff75a2c to your computer and use it in GitHub Desktop.
Save vunguyentuan/eab2f770786d824724ee8c00cff75a2c to your computer and use it in GitHub Desktop.
export function getVideoSourceByBrowser(sources) {
const isTaiwan =
getCookiesItem('foxplus_default_locale') &&
getCookiesItem('foxplus_default_locale').country === 'tw'
if (isChrome() || isFirefox()) {
const isTaiwanSource = [
'SCM Clean Mandarin Dash WM',
'Clean Mandarin Dash WM',
'Burnt-In Mandarin Dash WM'
]
const otherSource = [
'SCM Clean Original Dash WM',
'SCM Burnt-In Original Dash WM',
'Clean Original Dash WM',
'Burnt-In Original Dash WM',
'Burnt-In Dash WM',
'Clean Dash WM',
'iOS Video',
'Live'
]
const sourcesList = isTaiwan
? [...isTaiwanSource, ...otherSource]
: [...otherSource]
return getVideoSource(sources, [
'Burnt-In DASH WM Multi',
'Clean Dash WM Multi',
...sourcesList
])
}
if (isSafari()) {
const isTaiwanSource = [
'SCM Clean Mandarin HLS FP',
'Clean Mandarin HLS FP',
'Burnt-In Mandarin HLS FP'
]
const otherSource = [
'SCM Clean Original HLS FP',
'SCM Burnt-In Original HLS FP',
'Burnt-In Original HLS FP',
'Clean Original HLS FP',
'Clean HLS FP',
'iOS Video',
'Live'
]
const sourcesList = isTaiwan
? [...isTaiwanSource, ...otherSource]
: [...otherSource]
return getVideoSource(sources, [
'Burnt-In HLS FP Multi',
'Clean HLS FP Multi',
...sourcesList
])
}
const isTaiwanSource = ['SCM Clean Mandarin SS PR', 'Burnt-In Mandarin SS PR']
const otherSource = [
'SCM Clean Original SS PR',
'SCM Burnt-In Original SS PR',
'Burnt-In Original SS PR',
'Clean SS PR',
'iOS Video',
'Live'
]
const sourcesList = isTaiwan
? [...isTaiwanSource, ...otherSource]
: [...otherSource]
return getVideoSource(sources, [
'Burnt-in SS PR Multi',
'Clean SS PR Multi',
...sourcesList
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment