-
Notifications
You must be signed in to change notification settings - Fork 160
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
Video playback API overhaul #2155
Comments
I am leaving here the link for Godot docs on case it's useful (the Godot engine also only supports Theora playback). https://docs.godotengine.org/en/stable/tutorials/animation/playing_videos.html The difference that I think matters most when going from video running exclusively on the screen vs video running just on an in-game element, is the video FPS. When the video runs exclusively on screen like today, it can in theory have "any" fps (like 25fps) but when video is run in-game elements, it really is best if the encoded fps is an integer multiple or fraction of the game (say 30fps video in a 60fps game). I don't think there's much to do here other than telling this somewhere in the manual. |
Right, above docs reminded me, the VideoPlayback should have "autoplay" property, and a command to go frame by frame, for a custom pacing control. |
Just checking around other engines
So löve has also strictly Theora support (I guess this is how it goes in FOSS projects) and GameMaker doesn't specify support leaving for the platforms. About the API itself, it looks like the general idea that we want contains the features available in those - GameMaker is a bit weird like if you draw each frame using a DrawingSurface. Löve has an interesting thing on the filter used for scaling when rendering the video - either linear or nearest neighbor and if the filter is applied either when sizing up or down, this is interesting because I can see linear when sizing down and nearest when sizing up in a mixed size pixelart game. Ah about script names, I wonder if one day we will have VIEWS as enum, because then they would be named like eViewNameOfView, and this leaves the single v letter available for videos in script name like vIntro in Vincent's example in the forum post. |
We could have separate filters for the whole game too.
Um, that naming does actually sound like a dubious idea, as people might have a habit of calling views starting with 'v' already. Just because something is enum for strictness does not mean that we are obliged to enforce 'e' letter. Besides, views are 99% much more common than videos in AGS games. Another thing, View may eventually become a managed struct for consistency with other objects in game, and be addressed with a pointer (but this is just to mention a possibility). |
We could use |
There's something that I realized that trying to add an interface for "audio player" into plugin api (#2256). If you have a Video playing, then the audio control should likely be restricted to what it may do. Which means that we should not put video's audio onto a AudioChannel, at least not with the controls it has now. Likely there has to be two separate script structs, one that defines a audio player (playback control), and another that defines audio manipulator, or output (settings control). "Audio player" may as well inherit "manipulator". But Video player struct then should only expose a "manipulator" for audio. |
It could be AudioChannelBase or AudioChannelSimple and then AudioChannel just extends that, so that the video could give a pointer for the more restrictive interface. |
Oh, but the names in api should reflect what the object does. I think, if anything, the "base" is actually something that controls playback. On the other hand, remembering the discussions about better audio api, the future of "channel" is not clear, so I would not like to bind any more names to that. This is something that adjusts running audio data. Other terms that come to mind are: AudioSettings, AudioControl (?), Modifier, Panel, Tumbler, Tuner ... AudioLevels? AudioProperties? ... |
|
But "playback" is something that controls playback, this would rather be a name for an object that has pause/resume/stop/seek etc, everything that AudioChannel has now. |
Right. |
I thought about this, but is not "mixer" something that mixes 2+ audio streams into one? |
It can be. At it's core is generally a device or digital panel where you set volume, panning, bass, treble, etc, for one or more streams. If you want an alternative term just for these audio properties "mixer" should be an intuitive choice. |
Supposing so, but what if in the future we'd want an actual mixer in script api, that's lets mix sound from 2+ channels (or whatever audio source is called then) and this name will be already taken by an object that works as a audio modifier? EDIT: this makes me think further, that since the video's sound is also a sound stream, then one might like to pass it ("plug in") into the mixer as well... so it has to be a kind of thing that you may pass somewhere as a "audio stream"... Perhaps it may make sense to theorize a new audio API first, prior to video; or along with it. EDIT2: since love2d video was posted as an example above, it's curious that they did not care about this issue, and simply return a regular "audio source" from Video: |
If the VideoPlayback object is going to exclusively control an audio voice by itself, you might also simply add Volume/Panning directly into VideoPlayback and call it a day without intermeditate objects or other layers. That way you can postpone the design of a new Audio API and still have something usable. |
Resolved by #2338 |
Problem
Video playback API in AGS is rudimentary, it only allows to play a single video, blocking whole game, and nothing else may be updated nor drawn on screen while this video is playing. While this is not the most popular kind of request, there are still users who would like to be able to make proper FMV-style games with AGS, or at least have more control over cinematic cutscenes.
At the moment this may only be achieved using a plugin, but using plugins is always a last resort, as they don't always have full sync with what engine does (think of audio), and one has to ensure that the plugin is built for all wanted platforms.
Long story short, there's a certain demand to have a better video playback API. The basic requirements are:
We had a discussion about this on forums a while back:
https://www.adventuregamestudio.co.uk/forums/engine-development/feature-request-videos-non-blocking-playback-with-guis/
Following is based on my comment there, but this is a draft idea, so may be discussed and rethought further.
Proposal
In regards to the Script API:
VideoPlayback
struct in script.VideoPlayback
object is returned fromPlayVideo
(or similar) function, and provides means for controlling video state, including but not necessarily limited to: Pause, Resume, Seek functions, Length and Position properties.VideoPlayback
does not draw anything on screen itself. Instead it has aGraphic
property, that lets access a dynamic sprite, created and "owned" by the Playback object, where the video frames are decoded to. This property may then be used to draw or assign this sprite anywhere, in a same way as any other sprite is used in the engine.VideoPlayback
should have aAudioChannel*
property, which lets to access a channel where video's audio track is being played. NOTE: if we modify audio API prior to this, then this should be changed accordingly.EDIT: later I had strong doubts about using
AudioChannel
for this purpose, as that gives audio playback controls, which will overcomplicate things. Please refer to my comment below: Video playback API overhaul #2155 (comment)In regards to the underlying implementation:
There may be a number of secondary questions. Like do we need video to have its own "audio type", for easier managing default volume and reserve channels? do we need to have videos in the project explorer in the Editor (like some users suggest)? and so forth. But these all may be decided later, after the main bulk of work is done.
The text was updated successfully, but these errors were encountered: