danog\MadelineProto\EventHandler\Calls\AbstractGroupCall
Author: Daniil Gentili daniil@daniil.it
What a video chat/livestream »
({@see GroupCall}) and a live story » ({@see LiveStory}) have in common: both are group calls the server mixes (not end-to-end encrypted), with the same joining, participants, playback, recording, in-call messages and settings.
See https://core.telegram.org/api/group-calls for more info.
Properties
$id:intGroup call ID.$accessHash:intAccess hash of the group call.$peerId:?intBot API ID of the peer the call belongs to (the group or channel of a video chat, the poster of a live story), if known.$participantsCount:intNumber of participants.$joinMuted:boolWhether new participants join muted.$canChangeJoinMuted:boolWhether we may change whether new participants join muted (admins).$joinDateAsc:boolWhether participants are sorted by join date (ascending) rather than by activity.$canStartVideo:boolWhether we may start streaming video (the video limit is not reached yet).$rtmpStream:boolWhether the media is published by an external RTMP application rather than by a participant.$listenersHidden:boolWhether the listeners are hidden.$creator:boolWhether we created this call.$messagesEnabled:boolWhether in-call messages are enabled.$canChangeMessagesEnabled:boolWhether we may enable or disable in-call messages (admins).$inviteLink:?stringThe invite link of the call, if any.$unmutedVideoCount:?intHow many participants are transmitting video.$unmutedVideoLimit:intHow many participants may transmit video at once.$streamDcId:?intThe DC to use when downloading media chunks in stream mode.$discarded:boolWhether the call has ended.$duration:?intDuration of the call in seconds, once it has ended.
Method list:
join(bool $muted = false): staticleave(): staticdiscard(): staticisJoined(): boolgetCallState(): \danog\MadelineProto\GroupCall\GroupCallStategetParticipants(): array<int, \danog\MadelineProto\GroupCall\Participant>getParticipant(mixed $participant): ?\danog\MadelineProto\GroupCall\ParticipantgetVisualization(): ?arraysetMuted(bool $muted = true): staticisMuted(): boolsendMessage(string $message, (\danog\MadelineProto\ParseMode|null) $parseMode = NULL, (int|null) $paidStars = NULL, mixed $sendAs = NULL): staticsendReaction(string $emoji, (int|null) $customEmojiId = NULL): staticdeleteMessages(list<int> $ids, bool $reportSpam = false): staticdeleteParticipantMessages(mixed $participant, bool $reportSpam = false): staticsetMessagesEnabled(bool $enabled): staticmuteParticipant(mixed $participant, bool $muted = true): staticsetParticipantVolume(mixed $participant, int $volume): staticsetVideoPaused(bool $paused): staticsetJoinMuted(bool $joinMuted): staticresetInviteHash(): staticsetOutput(\danog\MadelineProto\LocalFile|\danog\MadelineProto\LocalDirectory|\Amp\ByteStream\WritableStream $file, mixed $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL): staticplay(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticplayBlocking(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticthen(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticskip(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticstop(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticpause(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticisPaused(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): boolresume(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): staticplayOnHold(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera, \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream ...$files): staticgetCurrent(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): \danog\MadelineProto\RemoteUrl|\danog\MadelineProto\LocalFile|string|nullenablePresentation(): staticdisablePresentation(): staticisSharingScreen(): boolisStreamMode(): boolisRtmpMode(): boolsetTitle(string $title): staticinvite(mixed ...$users): staticexportInvite(bool $canSelfUnmute = false): stringremoveParticipant(mixed ...$participants): static
Methods:
join(bool $muted = false): static
Join the call.
Parameters:
$muted:boolWhether to join muted.
leave(): static
Leave the group call, without ending it for the other participants.
discard(): static
End the group call for all participants.
isJoined(): bool
Whether we are currently in the group call (joined and not left).
getCallState(): \danog\MadelineProto\GroupCall\GroupCallState
Get the state of the group call.
See also:
getParticipants(): array<int, \danog\MadelineProto\GroupCall\Participant>
Get all known participants, indexed by their bot API peer ID.
See also:
getParticipant(mixed $participant): ?\danog\MadelineProto\GroupCall\Participant
A participant of the call by their id, username or peer, or null if they are not in it.
Parameters:
$participant:mixed
See also:
getVisualization(): ?array
Video chats and livestreams are not end-to-end encrypted, so there is no key to verify: always null.
setMuted(bool $muted = true): static
Mute or unmute our own audio stream.
Parameters:
$muted:bool
isMuted(): bool
Whether our own audio stream is muted.
sendMessage(string $message, (\danog\MadelineProto\ParseMode|null) $parseMode = NULL, (int|null) $paidStars = NULL, mixed $sendAs = NULL): static
Send an in-call message », shown as an overlay by the participants’ clients (there is no chat history), if messages are enabled.
Parameters:
$message:stringThe text; markup in$parseModeis converted to entities.$parseMode:(\danog\MadelineProto\ParseMode|null)Whether to parse HTML or Markdown markup in the text.$paidStars:(int|null)Live stories only: Telegram Stars to donate with the message (at least {@see self::$sendPaidMessagesStars}).$sendAs:mixedLive stories only: the peer to send the message as.
See also:
sendReaction(string $emoji, (int|null) $customEmojiId = NULL): static
Send an in-call reaction ».
Parameters:
$emoji:stringThe emoji.$customEmojiId:(int|null)The document id of a custom emoji to send instead,$emojibeing its fallback.
deleteMessages(list<int> $ids, bool $reportSpam = false): static
Delete in-call messages: our own, or anyone’s if we are an admin.
Parameters:
$ids:list<int>IDs of the messages to delete.$reportSpam:boolAlso report them as spam (admins only).
deleteParticipantMessages(mixed $participant, bool $reportSpam = false): static
Delete every in-call message of a participant (admins only).
Parameters:
$participant:mixed$reportSpam:boolAlso report them as spam.
setMessagesEnabled(bool $enabled): static
Enable or disable in-call messages (admins only).
Parameters:
$enabled:bool
muteParticipant(mixed $participant, bool $muted = true): static
Mute or unmute a participant (admins only; a participant muted by an admin may not unmute themselves), or, for a non-admin, mute a participant only for ourselves.
Parameters:
$participant:mixed$muted:bool
setParticipantVolume(mixed $participant, int $volume): static
Set our local playback volume of a participant.
Parameters:
$participant:mixed$volume:intFrom 1 to 20000, where 10000 is 100%.
setVideoPaused(bool $paused): static
Pause or resume our own video stream, telling the other participants to keep showing the last frame rather than hiding it.
Parameters:
$paused:bool
setJoinMuted(bool $joinMuted): static
Whether new participants join muted (admins only).
Parameters:
$joinMuted:bool
resetInviteHash(): static
Invalidate every invite link exported so far (admins only).
setOutput(\danog\MadelineProto\LocalFile|\danog\MadelineProto\LocalDirectory|\Amp\ByteStream\WritableStream $file, mixed $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL): static
Record group call media, muxed into a Matroska file in pure PHP.
Only a {@see LocalDirectory} is accepted: it records every transmitting participant — or only the
given $participant — as <dir>/<peerId>.<n>_<streams>.mkv files, one per combination of the
audio, camera video and screen share they send, each on or off at any time (see
{@see Call::setOutput()}; participants that start transmitting later are picked up too). Our own
media is never recorded.
Participants’ frames are stored as-is, so the video tracks are whatever codec they send and the
audio is OPUS; $format picks the {@see RecordingFormat::Mkv} (default) or {@see RecordingFormat::Webm}
DocType, autodetected from a .webm extension. Audio-only OGG OPUS recordings are not supported,
except in stream mode » ({@see self::isStreamMode()}),
where there is a single mixed audio stream rather than one per participant: pass no $participant
(a {@see LocalDirectory} records it as <dir>/stream.ogg), and any {@see RecordingFormat}.
Parameters:
$file:\danog\MadelineProto\LocalFile|\danog\MadelineProto\LocalDirectory|\Amp\ByteStream\WritableStream$participant:mixed$format:?\danog\MadelineProto\RecordingFormat
See also:
\danog\MadelineProto\LocalFile: Indicates a local file to upload.\danog\MadelineProto\LocalDirectory: Indicates a local directory to write output into.\Amp\ByteStream\WritableStream\danog\MadelineProto\RecordingFormat: Container format of a call recording, as passed to {@see Call::setOutput()}.
play(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Play a file, transmitting its audio and, if it carries a transmittable one, its video.
A WebM/Matroska file with VP8, VP9 or H.264 video has its video transmitted too; any other
file (or a raw audio stream) is played as audio only. Frames are demuxed in pure PHP and sent
as-is where possible, so no transcoding (and thus no FFI extension) is required for
pre-encoded WebM/OGG-OPUS input.
Parameters:
$file:\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream$dest:\danog\MadelineProto\MediaDestination
See also:
\danog\MadelineProto\LocalFile: Indicates a local file to upload.\danog\MadelineProto\RemoteUrl: Indicates a remote URL to upload.\Amp\ByteStream\ReadableStream\danog\MadelineProto\MediaDestination: Which media stream of a call a playback or recording operation targets.
playBlocking(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Play a file, blocking until it has finished playing if a stream is provided.
Parameters:
$file:\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream$dest:\danog\MadelineProto\MediaDestination
See also:
\danog\MadelineProto\LocalFile: Indicates a local file to upload.\danog\MadelineProto\RemoteUrl: Indicates a remote URL to upload.\Amp\ByteStream\ReadableStream\danog\MadelineProto\MediaDestination: Which media stream of a call a playback or recording operation targets.
then(\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream $file, \danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Play file.
Parameters:
$file:\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream$dest:\danog\MadelineProto\MediaDestination
See also:
\danog\MadelineProto\LocalFile: Indicates a local file to upload.\danog\MadelineProto\RemoteUrl: Indicates a remote URL to upload.\Amp\ByteStream\ReadableStream\danog\MadelineProto\MediaDestination: Which media stream of a call a playback or recording operation targets.
skip(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
When called, skips to the next file in the playlist.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
stop(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Stops playing all files, clears the main and the hold playlist.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
pause(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Pauses the currently playing file.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
isPaused(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): bool
Whether the currently playing file is paused.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
resume(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): static
Resumes the currently playing file.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
playOnHold(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera, \danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream ...$files): static
Files to play on hold.
Parameters:
$dest:\danog\MadelineProto\MediaDestination...$files:\danog\MadelineProto\LocalFile|\danog\MadelineProto\RemoteUrl|\Amp\ByteStream\ReadableStream
See also:
\danog\MadelineProto\MediaDestination: Which media stream of a call a playback or recording operation targets.\danog\MadelineProto\LocalFile: Indicates a local file to upload.\danog\MadelineProto\RemoteUrl: Indicates a remote URL to upload.\Amp\ByteStream\ReadableStream
getCurrent(\danog\MadelineProto\MediaDestination $dest = \danog\MadelineProto\MediaDestination::Camera): \danog\MadelineProto\RemoteUrl|\danog\MadelineProto\LocalFile|string|null
Get the file that is currently being played.
Will return a string with the object ID of the stream if we’re currently playing a stream,
otherwise returns the related LocalFile or RemoteUrl.
Parameters:
$dest:\danog\MadelineProto\MediaDestination
See also:
\danog\MadelineProto\MediaDestination: Which media stream of a call a playback or recording operation targets.\danog\MadelineProto\RemoteUrl: Indicates a remote URL to upload.\danog\MadelineProto\LocalFile: Indicates a local file to upload.
enablePresentation(): static
Start sharing a screen: a second connection (phone.joinGroupCallPresentation) whose video is transmitted on the {@see MediaDestination::Presentation} stream. Idempotent; requires the call to
be joined.
disablePresentation(): static
Stop sharing the screen.
isSharingScreen(): bool
Whether a screen-share is currently being transmitted.
isStreamMode(): bool
Whether the server switched us to stream mode » (a large livestream, or an RTMP one): the call’s media is received by downloading chunks, and
there is a single mixed stream to record with {@see self::setOutput()} (pass no participant).
isRtmpMode(): bool
Whether the call’s media is published by a single external RTMP publisher.
setTitle(string $title): static
Change the title of the call.
Parameters:
$title:string
invite(mixed ...$users): static
Invite users to the call.
Parameters:
...$users:mixedThe users to invite (user ids, usernames or peers).
exportInvite(bool $canSelfUnmute = false): string
Export an invite link to the call.
Parameters:
$canSelfUnmute:boolWhether users joining with this link may speak without asking; ignored where the call has no such distinction.
removeParticipant(mixed ...$participants): static
Remove participants from the call.
Parameters:
...$participants:mixedThe participants to remove (user ids, usernames or peers).
Generated by danog/phpdoc