Skip to content

Video freezes on the first frame when played on Apple TV (tvOS) #2371

@halx99

Description

@halx99

Discussed in #2338

Originally posted by katwdev91 January 16, 2025
(Sorry for reposting the thread. Github suspended my account by mistake, and the previous thread is gone)

Test Environment
Axmol Engine v2.1.5
tvOS 17.3
tvOS Simulator 18.1
Xcode 16.1

Symptom
When playing MP4 files, the video player renders the very first frame and then freezes. The status remains stuck in the "Playing" state. Multitasking out of the app and coming back resumes the video.
I have tested the cpp-tests project and cannot consistently reproduce the issue with the built-in videos. The repro rate is around 30%. I noticed the issue is more likely to occur after reinstalling the app. However, the specific MP4 file I am using (MPEG-4 AAC, HEVC) has almost 100% reproduction rate. (Please see attached demo project).

Finding
It seems something went wrong in AvfMediaEngine::transferVideoFrame(). hasNewPixelBufferForItemTime always returns false, until I multitask out of the app and then back in.

Temporary Workaround
I commented out the line videoOutput.suppressesPlayerRendering = YES; to fix the problem for now. I believe this is not the proper solution though, as it turns back on the system’s auto-rendering.

Does anyone know a fix for this?

Edit:
Attach a minimal demo to reproduce the issue (project created with Axmol 2.3.2):
tv-test.zip
(Can easily reproduce the issue on first launch. Make sure to uninstall previous version and do fresh install. 2nd+ launches can not reproduce the issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions