Files
otunes/apps/mobile/lib/playback-capabilities.ts
T

25 lines
857 B
TypeScript

import { Platform } from "react-native"
import {
DOWNLOAD_QUALITIES,
type DownloadQuality,
} from "@otunes/convex/download-quality"
// Android Dolby decoder reports do not reliably indicate working Atmos playback.
export const dolbyAtmosSupported = Platform.OS === "ios"
/** Whether to stream Atmos for this user: they opted in and the device can play it. */
export function atmosEnabled(user: { preferAtmos?: boolean }) {
return dolbyAtmosSupported && (user.preferAtmos ?? false)
}
/** Whether this device may download in a quality. Android cannot download Atmos. */
export function downloadQualitySupported(quality: DownloadQuality) {
return quality !== "atmos" || dolbyAtmosSupported
}
/** Download qualities this device offers, lowest first. */
export const deviceDownloadQualities = DOWNLOAD_QUALITIES.filter(
downloadQualitySupported
)