video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
20 lines (15 loc) • 410 B
text/typescript
const FULLSCREEN_LAPSE = 100
const THUMBNAIL_MAX_WIDTH = 400
export const viewmode = (width: number, height: number): string => {
const {screen} = window
const isFullscreen =
width + FULLSCREEN_LAPSE > screen.width &&
height + FULLSCREEN_LAPSE > screen.height
if (isFullscreen) {
return 'fullscreen'
}
if (width < THUMBNAIL_MAX_WIDTH) {
return 'thumbnail'
}
return 'normal'
}