Skip to content

HarmonyOS devices: Safe area insets not respected, controls overlap system navigation bar #9134

@wang14525-cpu

Description

@wang14525-cpu

Description

Issue Summary:
Video.js does not properly handle safe area insets on HarmonyOS devices, causing the player controls and navigation buttons to overlap with the system navigation bar at the bottom of the screen.

Expected Behavior:
The video player controls should respect the system safe area insets (similar to iOS's env(safe-area-inset-bottom)) and adjust their position to avoid overlapping with HarmonyOS's navigation bar.

Actual Behavior:
The bottom controls and custom navigation buttons are rendered underneath the HarmonyOS system navigation bar, making them partially or fully inaccessible to users.

Context:
I'm developing mini-programs (lightweight apps) for the HarmonyOS ecosystem and encountered this issue when integrating Video.js. HarmonyOS has 900+ million active devices, primarily in the Chinese market, and uses a gesture navigation bar similar to modern iOS/Android devices.

Root Cause:
Video.js's browser detection (browser.js) does not recognize HarmonyOS devices. As a result:
HarmonyOS is not detected as a mobile platform (IS_ANDROID = false, IS_IOS = false)
Safe area handling logic designed for iOS/Android is not applied to HarmonyOS
The player treats HarmonyOS devices as desktop browsers

HarmonyOS User Agent Example:
Mozilla/5.0 (Linux; HarmonyOS 5.0.0; NOH-AN00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36

Note: The UA contains HarmonyOS and Mobile, but lacks the Android or iPhone keywords that Video.js currently checks for.

Reduced test case

https://codepen.io/Zheng-Wang-the-scripter/pen/xbVaQWm

Steps to reproduce

  1. Open the test case URL on a HarmonyOS device (phone or tablet with system navigation bar enabled)
  2. Play the video to show the control bar
  3. Observe that the bottom controls overlap with the system navigation bar
  4. Try to tap the play/pause or fullscreen buttons at the bottom - they are partially obscured
  5. Check browser console: videojs.browser.IS_ANDROID returns false (should be true or have separate IS_HARMONYOS flag)

Errors

videojs.browser.IS_ANDROID = false // Expected: true (or IS_HARMONYOS = true)
videojs.browser.IS_IOS = false // Correct
videojs.browser.IS_IPHONE = false // Expected: true for phones with "Mobile" in UA
videojs.browser.TOUCH_ENABLED = true // Correct

What version of Video.js are you using?

v8.23.4

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

Uniapp (WeChat WebView)

What OS(es) and version(s) does this occur with?

HarmonyOS 5.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: triageThis issue needs to be reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions