Skip to content

fix(render): This pr resolves black camera feed on fivm enhanced #287 - #291

Closed
forzayt wants to merge 2 commits into
Samuels-Development:mainfrom
forzayt:main
Closed

forzayt wants to merge 2 commits into
Samuels-Development:mainfrom
forzayt:main

Conversation

@forzayt

@forzayt forzayt commented Sep 19, 2026

Copy link
Copy Markdown

Summary

This pr focuses on the issue #287 which shows a black screen for everything in the game world on the mobile camera.
The existing cfx texture crashes while the game back buffer into Nui due to the enhanced version , so i added a simple fallback logic which will switch to a dom based element which enhanced version supports and it will produces on the targets camera..

Type of Change

  • Bug Fix
  • New Feature
  • Improvement / Refactor
  • Performance
  • Documentation
  • Compatibility
  • Other

Related Issues

Main intention to slove this one #287

Breaking Changes

Does this introduce any breaking changes?

No, cause this won't removes any existing codes legacy clients still uses the same logic as earlier , just adds up a simple fallback logic on the runtime which activates only on enhanced versions

@pgpgames

Copy link
Copy Markdown

tysm for making this i hope he approves this

@Github-Samuel

Copy link
Copy Markdown
Member

Thanks for digging into this @forzayt. Falling back to the game view element on Enhanced was the right idea, and it is now on main in de34d1b.

I could not merge this as it stands because of two things I hit while testing it in game:

  • drawImage does not accept an <object> element. CEF throws a TypeError on every frame, and the empty catch hides it, so the fallback never painted anything.
  • The black check ran once at frame 5 and the switch was permanent. Opening the camera during a screen fade (respawn, teleport, entering an interior) left the viewfinder black on Legacy until the camera was closed and reopened.

What de34d1b does instead:

  • The element is shown in place over the viewfinder rather than copied into the canvas, and it is cropped with CSS to match the normal framing, in portrait and landscape.
  • Legacy servers never run any of it. Enhanced is detected from the server build, and EnhancedGameView in configs/photos.lua ('auto', 'probe', 'force', false) is the override.
  • The black check repeats and is reversible, so a fade shows the overlay for a moment and then hands back to the normal feed.

One limit worth knowing: the element's pixels cannot be read, so this only fixes the live viewfinder. Photos, clips, Live and video calls on Enhanced will still come out black until Cfx fixes game view capture (citizenfx/rfc#281).

I have not been able to test on an Enhanced client myself. If you can try main and tell me whether the viewfinder shows up for you, that would help a lot. If 'auto' does not pick your server up, set EnhancedGameView = 'probe'.

Closing this in favour of that commit.

@forzayt

forzayt commented Sep 21, 2026

Copy link
Copy Markdown
Author

Awesome, thanks for refining the logic and getting this implemented on main! It makes perfect sense why the drawImage method and static frame check were causing those issues. I'll test out the new commit on an Enhanced client as soon as I can and let you know if I run into any issues with the viewfinder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants