Skip to content

Added Support for VideoCalls, Screensharing and Optimized CPU Usage during calls - #916

Open
Laky-64 wants to merge 49 commits into
TGX-Android:mainfrom
pytgcalls:main
Open

Laky-64 wants to merge 49 commits into
TGX-Android:mainfrom
pytgcalls:main

Conversation

@Laky-64

@Laky-64 Laky-64 commented Aug 30, 2025 •

Copy link
Copy Markdown
Contributor

The guide below provides the flow for creating a perfect pull request to the Telegram X Repository. Before submitting your PR, ensure that it complies with the following principles.
Screenshot_20250830_170202_NTgCallsX

Screen_Recording_20250830_170141_NTgCallsX.mp4

Perfect PRs must be:

  • Rational. This PR replaces the old TgCalls implementation with NTgCalls, adding full support for video calls and screen sharing, while also introducing a more efficient CPU usage management. To enable NTgCalls locally, you need to add the following line in your local.properties file:

    app.ntgcalls=true
    
  • Completed. All changes have been tested with one-to-one and group calls (both audio and video) as well as screen sharing sessions.
  • Up-To-Date. The PR is based on the latest commit of the 'main' branch.

When fixing issues, make sure that your PR is:

  • Sufficient. The new implementation fixes performance bottlenecks in the previous TgCalls integration, addressing high CPU usage and improving stability in long-running calls.
  • Separated. This PR only focuses on the migration to NTgCalls and the related improvements (video, screen sharing, CPU optimization). Other unrelated fixes are left for separate PRs.
  • Linked. If there is a specific issue in the tracker about calls performance or missing video support, it should be linked here (e.g., Closes #1234).
  • Creating. The new features have been tested across multiple devices to ensure they don’t break other parts of the app.
  • Consistent. Screenshots or video previews should be attached if there are UI changes related to video call and screen sharing interfaces.

When adding features, expect:

  • Discussion. Open to suggestions regarding UX/UI flow of video calls and screen sharing integration.
  • Dismissal. Not applicable yet, feature follows Telegram X’s style but can be refined if requested.

Other contributions:

  • Rational. Optimized the existing call system with better CPU management, ensuring reduced resource consumption during calls.
  • Improved. Code refactoring makes the call handling logic cleaner, more modular, and easier to maintain.

japananimetime added a commit to japananimetime/Telegram-X that referenced this pull request Jan 17, 2026
- Add BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions for Android 12+
- Add USE_NTGCALLS BuildConfig flag (controlled by app.ntgcalls in local.properties)
- Add useNTgCalls to ApplicationConfig and ConfigurationPlugin
- Add conditional NTgCalls dependency (io.github.pytgcalls:ntgcalls:2.0.6)

Note: The NTgCalls interface code from PR TGX-Android#916 requires API compatibility
updates - the PR was written for a different version of the NTgCalls library
with packages (media, p2p, devices, exceptions) that don't exist in the
public Maven Central release.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Laky-64
Laky-64 force-pushed the main branch 2 times, most recently from 64777e7 to 225c605 Compare January 22, 2026 12:46
hnitgyi034-source

This comment was marked as spam.

@Laky-64
Laky-64 force-pushed the main branch 2 times, most recently from a1c1b9f to 1617e78 Compare February 2, 2026 02:19
japananimetime added a commit to japananimetime/Telegram-X that referenced this pull request Feb 8, 2026
Revert all 8 NTgCalls-related commits. The original developer
(Laky-64/null-nick) has made their own proper implementation,
so our custom cherry-picked version is no longer needed.

Reverted commits:
- 3e82450 Add NTgCalls integration from PR TGX-Android#916
- df7b562 Add NTgCalls build configuration and Bluetooth permissions
- 2695c8a Add group call support and voice/video restriction UI
- 5751cad Add Bluetooth runtime permission checks for Android 12+
- 7c23b5a Add video rendering to GroupCallController
- b341699 Add video chat management features
- 0169b97 Fix video chat API calls
- f544b6d Add Invite to Video Chat feature

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
japananimetime added a commit to japananimetime/Telegram-X that referenced this pull request Jun 11, 2026
Revert all 8 NTgCalls-related commits. The original developer
(Laky-64/null-nick) has made their own proper implementation,
so our custom cherry-picked version is no longer needed.

Reverted commits:
- 3e82450 Add NTgCalls integration from PR TGX-Android#916
- df7b562 Add NTgCalls build configuration and Bluetooth permissions
- 2695c8a Add group call support and voice/video restriction UI
- 5751cad Add Bluetooth runtime permission checks for Android 12+
- 7c23b5a Add video rendering to GroupCallController
- b341699 Add video chat management features
- 0169b97 Fix video chat API calls
- f544b6d Add Invite to Video Chat feature

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vkryl
vkryl force-pushed the main branch 2 times, most recently from d5a3b7a to 7735236 Compare August 17, 2026 22:13
@syhrlr00-ship-it

Copy link
Copy Markdown

gh pr checkout 916

1 similar comment
@syhrlr00-ship-it

Copy link
Copy Markdown

gh pr checkout 916

Adapt to the renamed API surface: callback setters (`setFrameCallback` ->
`onFrames`, `setConnectionChangeCallback` -> `onConnectionChange`, ...),
`NetworkInfo.State` -> `ConnectionState`, reordered `AudioDescription` and
`VideoDescription` constructors, and snake_case fields on `Protocol` and
`Frame`. Video rotation is now an enum, so map it to degrees explicitly.
Upstream removed the `libtgvoip` layer, converted `NLoader` to Kotlin,
replaced `ConfigurationPlugin` with `AppConfigurationPlugin` plus the
`tgxConfig` extension, and reworked the call button bar.

Fork-side resolutions:
* `useNTgCalls` moved to `AppConfigurationSource`, and `tgcalls` now reads
  the config through `tgxConfig` instead of `extra["config"]`.
* `NLoader.kt` skips `tgcallsjni` when ntgcalls is in use.
* `VoIP.getProtocol()` branches on `USE_NTGCALLS`; `VoIPController` and
  `VoIPServerConfig.nativeSetConfig` are gone with `libtgvoip`.
* The video and flip-camera buttons keep the fork's `LinearLayout` bar,
  with upstream's `extraBottomInset` height applied.
* `ENABLE_TGVOIP` stays `no` on the `legacy` flavor and otherwise honours
  the value gradle passes based on `app.ntgcalls`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants