Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoStreamPlayer not drawing anything when stopped, including not showing in editor #92050

Open
lostminds opened this issue May 17, 2024 · 4 comments

Comments

@lostminds
Copy link

Tested versions

v4.3.dev6.official [89850d5]

System information

macOS 14.5

Issue description

It appears the VideoStreamPlayer doesn't render any content when stopped, so it's invisible until playing. What I'd expect is that when a video stream is loaded, it would show the first frame of this video. In the editor this is a bit confusing as it appears like the video isn't loaded and makes layouting more difficult, and in the running project it means you have to do a couple of extra steps to get the video to show in a paused state before you start playing it.

Screenshot 2024-05-17 at 15 42 02

I can tell that the video is loaded since the control locks its' minimum size to the video size. If you run the project it's the same, the video player is blank until you call play() on the player but then the video displays as expected. If you then call stop() it becomes blank again.

Screenshot 2024-05-17 at 15 42 14

Once you've played at least one frame you can use paused = true to have the video display and not be playing. However, it seems it needs to play at least a little to load a first frame, so setting the player to autoplay = true and paused = true initially doesn't work. And in the editor there's no way to start playing as far as I can tell.

Steps to reproduce

  • Add a VideoStreamPlayer to a UI scene
  • Set the stream to a supported video file (needs to be a Ogg Theora .ogv file), for example this file: test_video.ogv
  • Observe the VideoStreamPlayer size change, but nothing showing

Minimal reproduction project (MRP)

video_player_test.zip

@AThousandShips
Copy link
Member

This might be a limitation of the implementation, and might depend on processing and resources, unsure if this is by design, but the video steam feature is somewhat lacking and is being considered for moving out of the engine entirely, so it's unclear what exactly might be the cause of this

@lostminds
Copy link
Author

the video steam feature is somewhat lacking and is being considered for moving out of the engine entirely

Yes, I noticed it was a little particular with the format/encoding requirement and I saw that support for another format was dropped in 4.0. I think that some way of showing prerendered cutscenes or intros may still be a very useful feature in many projects, as well as perhaps some more light-weight solution for showing smaller animations/videos without audio for in-game tutorials, demos of skills/abilities etc. So if the video player is moved out of the core, perhaps it could be a reason to re-consider support for loading simple animation formats like GIF and APNG (like in godotengine/godot-proposals#1433)

@AThousandShips
Copy link
Member

AThousandShips commented May 18, 2024

The problem is that playing videos in an open source manner is surprisingly difficult to maintain, it's a tangle of libraries and compatibility issues and even maintaining one format has proven difficult, see here for example

It'd depend on if this is simply a mistake in the code for the theora code, missing a frozen frame, or if it's a tricky issue with how it decodes frames, I unfortunately can't answer that since I don't know how that particular code or library works (I don't know if theora has interleaving, or compression that makes loading a single frame more difficult or expensive etc.)

@lostminds
Copy link
Author

lostminds commented May 18, 2024

The problem is that playing videos in an open source manner is surprisingly difficult to maintain

I'm sure this is the case, and as mentioned in godotengine/godot-proposals#7062 (comment) I think a better way forward would then be to fall back to system/OS specific video streaming solutions so it's not needed to be handled by Godot and can also benefit from .mp4/H.264 support and better hardware acceleration.

However, in this particular issue I don't think the problem is with the formats or encoding. When playing the video it displays just fine as far as I can tell. It's just that the video isn't displayed before you play (or after you've stopped it), and in the editor you can't play it. Either this is accidental or it's by design to save performance and resources by not preparing the video for display before it's started, but either way as I've described above I think it leads to some undesirable outcomes, especially when working in the editor.

A work-around of sorts to the editor display issue without needing to load or generate an initial still frame to display in the video could be to just add play and stop buttons to allow playing VideoStreamPlayers in the editor. I think a PR a while back added the functionality to add action buttons in the inspector, which could be used for this?

EDIT: I guess the PR for adding inspector buttons #78355 was never merged, but if it is, this could be a use case for it.

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

No branches or pull requests

2 participants