Giter Site home page Giter Site logo

kulakovd / tweb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from morethanwords/tweb

0.0 0.0 0.0 1.1 GB

Telegram Web K, GPL v3

Home Page: https://web.telegram.org/k/

License: GNU General Public License v3.0

JavaScript 1.18% TypeScript 89.82% HTML 0.37% GLSL 0.05% SCSS 8.58%

tweb's Introduction

This is a submission for Telegram contest for JS Developers. Tasks description.

The application is available online.

How tasks are implemented

Part 1 (Live Streaming)

I used Media Source API for video and Web Audio API. They are played separately and sync if one gets behind another, that usually happens when browser stops video when tab becomes invisible.

Each loaded part of live stream handled with mp4box. mp4box gets initialization and media segments for video. Also, mp4box extracts all audio samples form the chunk. Samples are decoded to PCM using opus-decoder.

Initialization segment of the first part is used when creating SourceBuffer.

Media segment is appended to SourceBuffer. Decoded audio is appended to AudioBuffer connected to AudioContext.

Before starting playback, first 3 parts (3 seconds) are buffered.

Part 2 (Chromium Issue Workaround)

Bug is related to reading AudioSpecificConfig. ASC contains information about channel count.

I find ASC in each video/mp4 streamed from ServiceWorker. If ASC is found and equal to 0x1388, I replace it with 0x1398.

This sets channel count in ASC to 0b0011 that is 3. It works also for 0b0010 that is 2, but only left channel is played. (The silence is played on right channel)

mp4a box still contains 1 channel count.

Added Dependencies

Telegram Web K

Based on Webogram, patched and improved. Available for everyone here: https://web.telegram.org/k/

Developing

Install dependencies with:

pnpm install

This will install all the needed dependencies.

Running web-server

Just run pnpm start to start the web server and the livereload task. Open http://localhost:8080/ in your browser.

Running in production

Run node build to build the minimized production version of the app. Copy public folder contents to your web server.

Dependencies

Debugging

You are welcome in helping to minimize the impact of bugs. There are classes, binded to global context. Look through the code for certain one and just get it by its name in developer tools. Source maps are included in production build for your convenience.

Additional query parameters

  • test=1: to use test DCs
  • debug=1: to enable additional logging
  • noSharedWorker=1: to disable Shared Worker, can be useful for debugging
  • http=1: to force the use of HTTPS transport when connecting to Telegram servers

Should be applied like that: http://localhost:8080/?test=1

Troubleshooting & Suggesting

If you find an issue with this app or wish something to be added, let Telegram know using the Suggestions Platform.

Licensing

The source code is licensed under GPL v3. License is available here.

tweb's People

Contributors

morethanwords avatar kulakovd avatar hanayashiki avatar emcifuntik avatar iamfronty avatar alexwebarchitect avatar ruslan-gennadievich avatar paradigman avatar gusarov avatar autoproblems avatar dependabot[bot] avatar fromaline avatar po-lan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.