23 public const NETWORK_ID = ProtocolInfo::PLAYER_VIDEO_CAPTURE_PACKET;
25 private bool $recording;
26 private ?
int $frameRate;
27 private ?
string $filePrefix;
32 private static function create(
bool $recording, ?
int $frameRate, ?
string $filePrefix) :
self{
34 $result->recording = $recording;
35 $result->frameRate = $frameRate;
36 $result->filePrefix = $filePrefix;
40 public static function createStartRecording(
int $frameRate,
string $filePrefix) :
self{
41 return self::create(
true, $frameRate, $filePrefix);
44 public static function createStopRecording() :
self{
45 return self::create(
false,
null,
null);
48 public function isRecording() :
bool{
return $this->recording; }
50 public function getFrameRate() : ?
int{
return $this->frameRate; }
52 public function getFilePrefix() : ?
string{
return $this->filePrefix; }
57 $this->frameRate = LE::readUnsignedInt($in);
58 $this->filePrefix = CommonTypes::getString($in);
65 if($this->frameRate ===
null){
66 throw new \LogicException(
"PlayerUpdateEntityOverridesPacket with recording=true require a frame rate to be provided");
69 if($this->filePrefix ===
null){
70 throw new \LogicException(
"PlayerUpdateEntityOverridesPacket with recording=true require a file prefix to be provided");
73 LE::writeUnsignedInt($out, $this->frameRate);
74 CommonTypes::putString($out, $this->filePrefix);
79 return $handler->handlePlayerVideoCapture($this);