Link Search Menu Expand Document

danog\MadelineProto\EventHandler\Calls\ConferenceCall

Back to index

Author: Daniil Gentili daniil@daniil.it

This update represents a Telegram end-to-end encrypted conference call ».

Unlike a plain {@see GroupCall} (a video chat or livestream), a conference call is not associated with any group or channel: it is a standalone, end-to-end encrypted multi-party call, whose media the SFU only ever forwards as ciphertext. On top of the shared {@see MultiCall} surface it exposes the conference-specific behaviour: the emoji verification » of the key, end-to-end encrypted in-call messages, and removing participants by rekeying.

This is a thin, serializable handle: every operation is delegated to the live conference controller ({@see \danog\MadelineProto\Tgcalls\E2E\ConferenceCall}) by call ID, so it keeps working across a process restart and over IPC.

Properties

  • $id: int Conference call ID.
  • $accessHash: int Access hash of the conference call.
  • $participantsCount: int Number of participants.
  • $creator: bool Whether we created this call.
  • $inviteLink: ?string The invite link of the conference call, if any.
  • $messagesEnabled: bool Whether in-call messages are enabled.
  • $unmutedVideoCount: ?int How many participants are transmitting video.
  • $unmutedVideoLimit: int How many participants may transmit video at once.
  • $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 conference call.

Parameters:

  • $muted: bool Whether to join muted.

isJoined(): bool

Whether we are currently in the conference (joined and not left/removed).

getCallState(): \danog\MadelineProto\EventHandler\Calls\GroupCallState

Get the state of the conference call.

See also:

leave(): static

Leave the conference call, without ending it for the other participants.

discard(): static

End the conference call for everyone, if we created it, and leave it.

Only the creator of a conference may end it: for anyone else the server refuses and this simply
{@see self::leave()}s the call.

getParticipants(): array<int, \danog\MadelineProto\EventHandler\Calls\ConferenceCallParticipant>

Get the participants currently in the conference, keyed by their user id, each with their Ed25519 public key, permission bits and protocol version from the shared-state chain.

See also:

getParticipant(string|int $participant): ?\danog\MadelineProto\EventHandler\Calls\ConferenceCallParticipant

A participant of the conference by their id, username or peer, with their Ed25519 public key, permission bits and protocol version from the shared-state chain, or null if not in it.

Parameters:

  • $participant: string|int

See also:

removeParticipant(string|int ...$participants): static

Remove participants from the conference and rekey for the remaining members, so the removed members can no longer decrypt the call’s media. Requires the remove_users permission.

Parameters:

  • ...$participants: string|int

invite(string|int ...$users): static

Invite users to the conference call, ringing them.

Parameters:

  • ...$users: string|int

exportInvite(bool $canSelfUnmute = false): string

The conference link » of this conference call, which anyone can use to join it.

Parameters:

  • $canSelfUnmute: bool Ignored: a conference has no admins, everyone may speak.

setTitle(string $title): static

Change the title of the conference call.

Parameters:

  • $title: string

getVisualization(): (list<string>|null)

The four key verification emojis », which every participant can compare to make sure nobody is in the middle.

Verification (a commit-reveal exchange between all participants) runs automatically whenever
the set of participants changes; this returns null until it completes for the current state.

sendMessage(string $message, (\danog\MadelineProto\ParseMode|null) $parseMode = NULL, (int|null) $paidStars = NULL, (string|int|null) $sendAs = NULL): static

Send an end-to-end encrypted in-call message » to every participant of the conference.

Parameters:

  • $message: string The text; markup in $parseMode is converted to entities (bold, italic, underline, strikethrough, spoiler and custom emoji are supported).
  • $parseMode: (\danog\MadelineProto\ParseMode|null) Whether to parse HTML or Markdown markup in the text.
  • $paidStars: (int|null) Ignored: conference messages cannot carry donations.
  • $sendAs: (string|int|null) Ignored: conference messages are always sent as ourselves.

See also:

sendReaction(string $emoji, (int|null) $customEmojiId = NULL): static

Send an end-to-end encrypted 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.

setMessagesEnabled(bool $enabled): static

Enable or disable in-call messages.

Parameters:

  • $enabled: bool

muteParticipant(string|int $participant, bool $muted = true): static

Mute a participant for ourselves only (a conference has no admins).

Parameters:

  • $participant: string|int
  • $muted: bool

setParticipantVolume(string|int $participant, int<1, 20000> $volume): static

Set our local playback volume of a participant.

Parameters:

  • $participant: string|int
  • $volume: int<1, 20000> 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.

Parameters:

  • $joinMuted: bool

resetInviteHash(): static

Invalidate the conference link exported so far, so a new one is generated.

isStreamMode(): bool

A conference is always received over WebRTC (its media is end-to-end encrypted): never in stream mode.

isRtmpMode(): bool

A conference has no RTMP publisher.

isSharingScreen(): bool

Whether a screen-share is currently being transmitted.

enablePresentation(): static

Start sharing a screen: a second, end-to-end encrypted connection whose video is transmitted on the {@see MediaDestination::Presentation} stream. Idempotent; requires the call to be joined.

disablePresentation(): static

Stop sharing the screen.

setOutput(\danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream $file, string|int|null $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL, (StreamMask|null) $streams = NULL): StreamMask

Record one participant into a single file (or stream) with a fixed set of tracks, muxed into Matroska in pure PHP. Every recording is plaintext — the frames are decrypted before they are muxed.

$participant (a user id, username or peer) is required: every participant is recorded to its
own file, see {@see self::setOutputFolder()} to record everyone at once. Our own media is never recorded.

The file holds the streams chosen with $streams — a bitmask of {@see CallStream::AUDIO},
{@see CallStream::VIDEO} and {@see CallStream::SCREEN}, every one of which must be available — or,
when null, every stream the participant currently sends; the available streams are returned. The
tracks are fixed for the whole file: a stream turned off stops being written and resumes when it
comes back, and only a change of codec or the end of the call finishes the file (see
{@see Call::setOutput()}); every such event is reported by a {@see CallStreams} update.

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.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\Amp\ByteStream\WritableStream
  • $participant: string|int|null
  • $format: ?\danog\MadelineProto\RecordingFormat
  • $streams: (StreamMask|null) The streams to record, as a bitmask of {@see CallStream} flags, or null for every available one.

Return value: The streams the participant currently sends, as a bitmask of {@see CallStream} flags.

See also:

setOutputFolder(\danog\MadelineProto\LocalDirectory $dir, string|int|null $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL): static

Record conference call media into a directory, muxed into Matroska files in pure PHP.

Records every transmitting participant — or only the given $participant — as
<dir>/<userId>.<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::setOutputFolder()};
participants that start transmitting later are picked up too). Our own media is never recorded.
Every recording is plaintext — the frames are decrypted before they are muxed.

$format picks the {@see RecordingFormat::Mkv} (default) or {@see RecordingFormat::Webm} DocType.

Parameters:

  • $dir: \danog\MadelineProto\LocalDirectory
  • $participant: string|int|null
  • $format: ?\danog\MadelineProto\RecordingFormat

See also:

setMuted(bool $muted = true): static

Mute or unmute our own audio stream.

Parameters:

  • $muted: bool

isMuted(): bool

Whether our own audio stream is muted.

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, all end-to-end encrypted before it reaches the SFU.

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:


Generated by danog/phpdoc