Link Search Menu Expand Document

danog\MadelineProto\EventHandler\Calls\AbstractGroupCall

Back to index

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: int Group call ID.
  • $accessHash: int Access hash of the group call.
  • $peerId: ?int Bot 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: int Number of participants.
  • $joinMuted: bool Whether new participants join muted.
  • $canChangeJoinMuted: bool Whether we may change whether new participants join muted (admins).
  • $joinDateAsc: bool Whether participants are sorted by join date (ascending) rather than by activity.
  • $canStartVideo: bool Whether we may start streaming video (the video limit is not reached yet).
  • $rtmpStream: bool Whether the media is published by an external RTMP application rather than by a participant.
  • $listenersHidden: bool Whether the listeners are hidden.
  • $creator: bool Whether we created this call.
  • $messagesEnabled: bool Whether in-call messages are enabled.
  • $canChangeMessagesEnabled: bool Whether we may enable or disable in-call messages (admins).
  • $inviteLink: ?string The invite link of the call, if any.
  • $unmutedVideoCount: ?int How many participants are transmitting video.
  • $unmutedVideoLimit: int How many participants may transmit video at once.
  • $streamDcId: ?int The DC to use when downloading media chunks in stream mode.
  • $discarded: bool Whether the call has ended.
  • $duration: ?int Duration of the call in seconds, once it has ended.

Method list:

Methods:

join(bool $muted = false): static

Join the call.

Parameters:

  • $muted: bool Whether 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: string The text; markup in $parseMode is 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: mixed Live 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: string The emoji.
  • $customEmojiId: (int|null) The document id of a custom emoji to send instead, $emoji being 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: bool Also 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: bool Also 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: int From 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:

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:

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:

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:

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:

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:

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: mixed The users to invite (user ids, usernames or peers).

exportInvite(bool $canSelfUnmute = false): string

Export an invite link to the call.

Parameters:

  • $canSelfUnmute: bool Whether 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: mixed The participants to remove (user ids, usernames or peers).

Generated by danog/phpdoc