java.lang.Object | |
↳ | co.megacool.megacool.RecordingConfig |
Customize how a recording is done and how it's encoded into something that can be shared.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RecordingConfig()
Create new RecordingConfig.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RecordingConfig |
frameRate(int frameRate)
How often new frames should be recorded, in frames per second.
| ||||||||||
int |
getFrameRate()
Get the recording's capture frame rate, in frames per second.
| ||||||||||
int |
getLastFrameDelay()
Get the recording's last frame delay, in milliseconds.
| ||||||||||
int |
getLastFrameOverlay()
Get the recording's last frame overlay drawable.
| ||||||||||
String |
getLastFrameOverlayAsset()
Get the recording's last frame overlay asset.
| ||||||||||
int |
getMaxFrames()
Get the recording's max length in frames.
| ||||||||||
OverflowStrategy |
getOverflowStrategy()
Get the recording's overflow strategy.
| ||||||||||
double |
getPeakLocation()
Get the recording's peak location.
| ||||||||||
int |
getPlaybackFrameRate()
Get the recording's playback frame rate, in frames per second.
| ||||||||||
String |
getRecordingId()
Get the recording's identifier.
| ||||||||||
RecordingConfig |
id(String id)
Set an identifier for a recording, to be able to preview or share it again later.
| ||||||||||
RecordingConfig |
lastFrameDelay(int delay)
Set how long to pause the GIF on the last frame, in ms.
| ||||||||||
RecordingConfig |
lastFrameOverlay(int lastFrameOverlay)
Set the image that will be overlayed on the last frame of the gif
| ||||||||||
RecordingConfig |
lastFrameOverlayAsset(String lastFrameOverlayAsset)
Set the image that will be overlayed on the last frame of the gif
| ||||||||||
RecordingConfig |
maxFrames(int maxFrames)
Set the max number of frames in a recording.
| ||||||||||
RecordingConfig |
overflowStrategy(OverflowStrategy overflowStrategy)
Define how recordings longer than the specified max frames should be compressed.
| ||||||||||
RecordingConfig |
peakLocation(double peakLocation)
Set the location of the highest scoring moment (the peak) in a highlight recording.
| ||||||||||
RecordingConfig |
playbackFrameRate(int playbackFrameRate)
The frame rate the recording will be played back in.
| ||||||||||
String | toString() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Create new RecordingConfig.
Globals modified after instantiating a RecordingConfig has no effect on the given RecordingConfig.
How often new frames should be recorded, in frames per second.
This is only relevant when you use startRecording(View, RecordingConfig)
,
as when you use captureFrame(View, RecordingConfig)
the frames will be
captured in the rate you call captureFrame
.
The upper limit here will be restricted by how fast captures can occur on the given device, if set too high we'll just capture as many frames per second as possible, and you'll see highly variable results between devices. You probably shouldn't set this higher than 15-20 to avoid too much performance impact from the recording.
Calling this method will automatically update the playback frame rate to be 20% more than
the value passed in for frameRate
, unless you've previously called
playbackFrameRate(int)
frameRate | how frames to capture per second |
---|
Get the recording's capture frame rate, in frames per second.
Get the recording's last frame delay, in milliseconds.
Get the recording's last frame overlay drawable.
Get the recording's last frame overlay asset.
Get the recording's max length in frames.
Get the recording's overflow strategy.
Get the recording's peak location.
Get the recording's playback frame rate, in frames per second.
Get the recording's identifier.
Set an identifier for a recording, to be able to preview or share it again later. To be
able to store multiple completed recordings on disk you must also remember to set
setKeepCompletedRecordings(boolean)
to true.
id | the recording identifier |
---|
Set how long to pause the GIF on the last frame, in ms. Must be a non-negative integer, default is 1000.
If you pass 0, the delay will be the same as the other frames.
delay | how long to pause on the last frame |
---|
Set the image that will be overlayed on the last frame of the gif
lastFrameOverlay | the image to overlay |
---|
Set the image that will be overlayed on the last frame of the gif
lastFrameOverlayAsset | the name of the asset with the last frame overlay image |
---|
Set the max number of frames in a recording. If set to 1
the recording will be
shared as an image instead of a gif or mp4. If you set this to 1
you probably
also want to use modalTitle(String)
to change the default modal title so
that it doesn't say a GIF is about to be shared.
If the overflow strategy is set to TIMELAPSE
, the resulting GIF
might have a frame count between 1.33x and 0.66x what is set as max.
maxFrames | the target number of frames in the recording |
---|
Define how recordings longer than the specified max frames should be compressed.
Note that if maxFrames(int)
is set to 1
you cannot use
TIMELAPSE
. If this combination is set
LATEST
will be used instead.
overflowStrategy | the overflow strategy |
---|
Set the location of the highest scoring moment (the peak) in a highlight recording. Must be
between 0
and 1
, the default is 0.7
. Set the score
throughout the game with registerScoreChange()
. The recording must be using
the highlight overflow strategy for this to have any effect.
For example, in a recording with 10 frames, a peak location of 0.2
means that
the highest scoring frame will occur near the beginning at frame 2, and a peakLocation of
0.8
means that the peak will occur near the end at frame 8.
peakLocation | percentage of frames in the recording to include before the peak |
---|
The frame rate the recording will be played back in. Should be identical to the recording
frame rate set with frameRate(int)
to play back in real time, set higher to speed up the
recording or lower to slow it down. The max is 100fps, but you're unlikely to see browser
play it back at that rate, thus you should keep the rate in the 5-25 range to stay sane.
playbackFrameRate | the playback frame rate, as frames per second |
---|