Module pytgcalls.implementation.group_call_device
Expand source code
# tgcalls - a Python binding for C++ library by Telegram
# pytgcalls - a library connecting the Python binding with MTProto
# Copyright (C) 2020-2021 Il`ya (Marshal) <https://github.com/MarshalX>
#
# This file is part of tgcalls and pytgcalls.
#
# tgcalls and pytgcalls is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# tgcalls and pytgcalls is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License v3
# along with tgcalls. If not, see <http://www.gnu.org/licenses/>.
from typing import Optional
from pytgcalls.implementation import GroupCall
class GroupCallDevice(GroupCall):
def __init__(
self,
mtproto_bridge,
audio_input_device: Optional[str] = None,
audio_output_device: Optional[str] = None,
enable_logs_to_console=False,
path_to_log_file=None,
outgoing_audio_bitrate_kbit=128,
):
super().__init__(mtproto_bridge, enable_logs_to_console, path_to_log_file, outgoing_audio_bitrate_kbit)
self.__is_playout_paused = False
self.__is_recording_paused = False
self.__audio_input_device = audio_input_device or ''
self.__audio_output_device = audio_output_device or ''
def _setup_and_start_group_call(self):
self._start_native_group_call(self.__audio_input_device, self.__audio_output_device)
@property
def audio_input_device(self):
"""Get audio input device name or GUID
Note:
To get system recording device list you can use `get_recording_devices()` method.
"""
return self.__audio_input_device
@audio_input_device.setter
def audio_input_device(self, name=None):
self.set_audio_input_device(name)
@property
def audio_output_device(self):
"""Get audio output device name or GUID
Note:
To get system playout device list you can use `get_playout_devices()` method.
"""
return self.__audio_output_device
@audio_output_device.setter
def audio_output_device(self, name=None):
self.set_audio_output_device(name)
Classes
class GroupCallDevice (mtproto_bridge, audio_input_device: Optional[str] = None, audio_output_device: Optional[str] = None, enable_logs_to_console=False, path_to_log_file=None, outgoing_audio_bitrate_kbit=128)-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class GroupCallDevice(GroupCall): def __init__( self, mtproto_bridge, audio_input_device: Optional[str] = None, audio_output_device: Optional[str] = None, enable_logs_to_console=False, path_to_log_file=None, outgoing_audio_bitrate_kbit=128, ): super().__init__(mtproto_bridge, enable_logs_to_console, path_to_log_file, outgoing_audio_bitrate_kbit) self.__is_playout_paused = False self.__is_recording_paused = False self.__audio_input_device = audio_input_device or '' self.__audio_output_device = audio_output_device or '' def _setup_and_start_group_call(self): self._start_native_group_call(self.__audio_input_device, self.__audio_output_device) @property def audio_input_device(self): """Get audio input device name or GUID Note: To get system recording device list you can use `get_recording_devices()` method. """ return self.__audio_input_device @audio_input_device.setter def audio_input_device(self, name=None): self.set_audio_input_device(name) @property def audio_output_device(self): """Get audio output device name or GUID Note: To get system playout device list you can use `get_playout_devices()` method. """ return self.__audio_output_device @audio_output_device.setter def audio_output_device(self, name=None): self.set_audio_output_device(name)Ancestors
- GroupCall
- abc.ABC
- GroupCallDispatcherMixin
- pytgcalls.dispatcher.dispatcher_mixin.DispatcherMixin
- GroupCallNative
Class variables
var SEND_ACTION_UPDATE_EACH-
Inherited from:
GroupCall.SEND_ACTION_UPDATE_EACHHow often to send speaking action to chat
Instance variables
var audio_input_device-
Get audio input device name or GUID
Note
To get system recording device list you can use
get_recording_devices()method.Expand source code
@property def audio_input_device(self): """Get audio input device name or GUID Note: To get system recording device list you can use `get_recording_devices()` method. """ return self.__audio_input_device var audio_output_device-
Get audio output device name or GUID
Note
To get system playout device list you can use
get_playout_devices()method.Expand source code
@property def audio_output_device(self): """Get audio output device name or GUID Note: To get system playout device list you can use `get_playout_devices()` method. """ return self.__audio_output_device var enable_action-
Inherited from:
GroupCall.enable_actionIs enable sending of speaking action
var invite_hash-
Inherited from:
GroupCall.invite_hashHash from invite link to join as speaker
var is_connected-
Inherited from:
GroupCall.is_connectedIs connected to voice chat via tgcalls
Methods
async def edit_group_call(self, volume: int = None, muted=False)-
Inherited from:
GroupCall.edit_group_callEdit own settings of group call …
async def edit_group_call_member(self, peer, volume: int = None, muted=False)-
Inherited from:
GroupCall.edit_group_call_memberEdit setting of user in voice chat (required voice chat management permission) …
async def leave_current_group_call(self)-
Inherited from:
GroupCall.leave_current_group_callLeave group call from server side (MTProto part).
def on_network_status_changed(self, func: Callable) ‑> Callable-
Inherited from:
GroupCall.on_network_status_changedWhen a status of network will be changed …
def on_participant_list_updated(self, func: Callable) ‑> Callable-
Inherited from:
GroupCall.on_participant_list_updatedWhen a list of participant will be updated …
def print_available_playout_devices(self)-
Inherited from:
GroupCall.print_available_playout_devicesPrint name and guid of available playout audio devices in system. Just helper method …
def print_available_recording_devices(self)-
Inherited from:
GroupCall.print_available_recording_devicesPrint name and guid of available recording audio devices in system. Just helper method …
async def reconnect(self)-
Inherited from:
GroupCall.reconnectConnect to voice chat using the same native instance.
async def set_is_mute(self, is_muted: bool)-
Inherited from:
GroupCall.set_is_muteSet is mute …
async def set_my_volume(self, volume)-
Inherited from:
GroupCall.set_my_volumeSet volume for current client …
async def start(self, group, join_as=None, invite_hash: Optional[str] = None, enable_action=True)-
Inherited from:
GroupCall.startStart voice chat (join and play/record from initial values) …
async def stop(self)-
Inherited from:
GroupCall.stopProperly stop tgcalls, remove MTProto handler, leave from server side.