Link Search Menu Expand Document

danog\MadelineProto\EventHandler\Calls\PrivateCall

Back to index

Author: Daniil Gentili daniil@daniil.it

This update represents a private (one-to-one) VoIP Telegram call.

The old name {@see \danog\MadelineProto\VoIP} is kept as an alias for backwards compatibility.

Properties

  • $callID: int Phone call ID
  • $outgoing: bool Whether the call is an outgoing call
  • $video: bool Whether this is a video call.
  • $otherID: int ID of the other user in the call
  • $date: int When was the call created
  • $discardReason: ?danog\MadelineProto\VoIP\DiscardReason Why the call was discarded, if it was.
  • $conferenceSlug: ?string If the call was upgraded to a conference call », the conference deep link » slug of the new conference.

Conference calls are end-to-end encrypted and cannot be joined by MadelineProto yet.

Method list:

Methods:

join(bool $muted = false): static

Accept the incoming call.

Parameters:

  • $muted: bool Whether to accept with our own audio muted.

discard(\danog\MadelineProto\VoIP\DiscardReason $reason = \danog\MadelineProto\VoIP\DiscardReason::HANGUP, int<1, 5> $rating = NULL, string $comment = NULL): static

Discard call.

Parameters:

  • $reason: \danog\MadelineProto\VoIP\DiscardReason
  • $rating: int<1, 5> Call rating in stars
  • $comment: string Additional comment on call quality.

See also:

isJoined(): bool

Whether the call is running (accepted by both parties and connected).

getCallState(): \danog\MadelineProto\VoIP\CallState

Get call state.

See also:

getParticipants(): array<int, \danog\MadelineProto\VoIP\MediaState>

The other party of the call, keyed by their user ID, with their media state (mute, camera and screencast status) as reported by their client.

Empty until the call is connected and the other party has reported their media state.

See also:

getParticipant(mixed $participant): ?\danog\MadelineProto\VoIP\MediaState

The media state of the other party, if $participant is them and the call is connected.

Parameters:

  • $participant: mixed

See also:

getVisualization(): ?list{string, string, string, string}

Get the key verification emojis (will return null if the call is not inited yet).

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. The file is demuxed in pure PHP and its
frames are 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:

setOutput(\danog\MadelineProto\LocalFile|\danog\MadelineProto\LocalDirectory|\Amp\ByteStream\WritableStream $file, mixed $participant = NULL, ?\danog\MadelineProto\RecordingFormat $format = NULL): static

Record the incoming media of the call.

A {@see LocalFile} name.mkv records everything the other party sends — their audio, camera and
screencast, each on or off at any time — as name.0_<streams>.mkv, name.1_<streams>.mkv, …,
one file per combination of streams flowing (see {@see Call::setOutput()}); a
{@see LocalDirectory} records the same as <dir>/0_<streams>.mkv, <dir>/1_<streams>.mkv, …. A
{@see WritableStream} gets a single file that cannot roll over. $participant may only be the
other party, and is therefore optional.

A {@see RecordingFormat::Webm} or {@see RecordingFormat::Mkv} target records the incoming audio
and video, muxed into a Matroska file in pure PHP (the peer’s frames are stored as-is, so the
video tracks are whatever codec the peer sends — VP8/VP9/H.264/H.265/AV1 — and the audio is OPUS).
{@see RecordingFormat::Opus} keeps the audio-only behaviour and receives an OGG OPUS stream.

When $format is null it is autodetected from the extension of $file, but only if a
{@see LocalFile} was passed; a raw stream, whose extension is unknown, defaults to OGG OPUS.

Parameters:

  • $file: \danog\MadelineProto\LocalFile|\danog\MadelineProto\LocalDirectory|\Amp\ByteStream\WritableStream
  • $participant: mixed
  • $format: ?\danog\MadelineProto\RecordingFormat

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:

setMuted(bool $muted = true): static

Mute or unmute our own audio stream.

Parameters:

  • $muted: bool

isMuted(): bool

Whether our own audio stream is muted.

enablePresentation(): static

Start sharing a screen: bring up the presentation (screencast) video stream, so that files played on {@see MediaDestination::Presentation} are transmitted as a screencast. The other party is told
the screencast is active as soon as a file with video plays on it.

disablePresentation(): static

Stop sharing the screen: stop the presentation playlist and tell the other party the screencast is inactive.

isSharingScreen(): bool

Whether a screencast is currently being transmitted.


Generated by danog/phpdoc