20 public const NETWORK_ID = ProtocolInfo::PLAYER_VIDEO_CAPTURE_PACKET;
22 private bool $recording;
23 private ?
int $frameRate;
24 private ?
string $filePrefix;
29 private static function create(
bool $recording, ?
int $frameRate, ?
string $filePrefix) :
self{
31 $result->recording = $recording;
32 $result->frameRate = $frameRate;
33 $result->filePrefix = $filePrefix;
37 public static function createStartRecording(
int $frameRate,
string $filePrefix) :
self{
38 return self::create(
true, $frameRate, $filePrefix);
41 public static function createStopRecording() :
self{
42 return self::create(
false,
null,
null);
45 public function isRecording() :
bool{
return $this->recording; }
47 public function getFrameRate() : ?
int{
return $this->frameRate; }
49 public function getFilePrefix() : ?
string{
return $this->filePrefix; }
52 $this->recording = $in->getBool();
54 $this->frameRate = $in->
getLInt();
60 $out->putBool($this->recording);
62 if($this->frameRate ===
null){
63 throw new \LogicException(
"PlayerUpdateEntityOverridesPacket with recording=true require a frame rate to be provided");
66 if($this->filePrefix ===
null){
67 throw new \LogicException(
"PlayerUpdateEntityOverridesPacket with recording=true require a file prefix to be provided");
70 $out->putLInt($this->frameRate);
71 $out->putString($this->filePrefix);
76 return $handler->handlePlayerVideoCapturePacket($this);