giongto35 / cloud-game

Web-based Cloud Gaming service for Retro Game
https://www.youtube.com/watch?v=GUBrJGAxZZg
Apache License 2.0
2.32k stars 348 forks source link

Game recording support #356

Closed sergystepanov closed 2 years ago

sergystepanov commented 2 years ago

This PR adds the ability to record game sessions as raw a/v media files. This feature can be toggled by the recording.enabled param. If it's enabled, you will see an additional text field with a button in the UI. The text field allows adding an arbitrary username (or just a tag) to the recording filenames on the server. The recording button just turns on or off the recording. In case if you want to record your game session from the start, you should activate the button before you start a game. The button has a recording indicator: grey -- not active, red -- active, blinking red -- recording. Each recording should have a unique name (by default it will) so it can be used with multiple workers.

By default, the recorder will produce three types of files in the configured directory:

When a recording session is stopped or finished, the whole output directory will be compressed with ZIP and then deleted.

There is a list of new configuration params:

recording:
  enabled: false
  # image compression level:
  #   0 - default compression
  #  -1 - no compression
  #  -2 - best speed
  #  -3 - best compression
  compressLevel: 0
  # name contains the name of the recording dir (or zip)
  # format:
  # %date:go_time_format% -- refer: https://go.dev/src/time/format.go
  # %user% -- user name who started the recording
  # %game% -- game name (game ROM name)
  # %rand:len% -- a random string of given length
  # as example: 20210101101010_yeE_user1_badApple
  name: "%date:20060102150405%_%rand:3%_%user%_%game%"
  # save directory
  folder: ./recording

Considerations