ya-webadb
repository·main·Indexed 25 days ago
https://github.com/yume-chan/ya-webadbA TypeScript-based re-implementation of the ADB (Android Debugging Bridge) client called Tango, enabling ADB functionality in web browsers, Node.js, and Electron. The repository includes @yume-chan/adb-cli for mimicking standard adb tool functionality, as well as several utility libraries for Android Open Accessory (AOA) protocol via WebUSB, PCM audio playback, C-style structure serialization, and specialized Web Streams API extensions.
What's inside ya-webadb
- Tango is a TypeScript re-implementation of the Android Debugging Bridge (ADB) client. It is designed to work across multiple environments, including Chromium-based browsers (such as Chrome for Android), Node.js, and Electron.
Overview of @yume-chan/adb-cli
mainThe
@yume-chan/adb-cliis a Node.js command-line application designed to mimic the functionality of the standardadbtool.Requirement: This CLI requires a native Google ADB server to be running on the host machine to function.
Play raw audio sample streams with @yume-chan/pcm-player
mainThe
@yume-chan/pcm-playerlibrary allows you to play raw audio sample streams using the Web Audio API. It supports arbitrary channel counts and sample rates, and includes a basic OLA (overlap-add) resampler.Available Player Classes
Choose a player class based on your audio sample format:
Int16PcmPlayer: For little-endian 16-bit integer PCM data.Float32PcmPlayer: For 32-bit float PCM data.Float32PlanerPcmPlayer: For 32-bit float PCM data provided in a planar format (two-dimensional array, left channel first).
Note on Interleaved vs Planar:
- Non-Planar (e.g.,
Int16PcmPlayer,Float32PcmPlayer): Audio samples are interleaved (e.g.,[L, R, L, R...]). - Planar (e.g.,
Float32PlanerPcmPlayer): Audio samples are in a two-dimensional array (e.g.,[[L, L...], [R, R...]]).
Important: User Activation Requirement
Because the player constructors create an
AudioContext, they must be invoked within a user event handler (such as anonclickevent) to comply with browser autoplay policies.var player = Int16PcmPlayer(44100); player.start(); player.feed(new Int16Array([0, 0, 0, 0, 0, 0, 0, 0])); player.stop(); // `AudioContext` will be closed, so can't be restartedUse @yume-chan/adb-credential-nodejs for ADB credentials in Node.js
mainThe@yume-chan/adb-credential-nodejspackage provides an ADB credential store implementation specifically designed for Node.js environments. It allows you to manage and retrieve credentials required for ADB (Android Debug Bridge) connections within a Node.js application.Use @yume-chan/aoa for Android Open Accessory protocol via WebUSB
main@yume-chan/aoa is a TypeScript implementation of the Android Open Accessory (AOA) protocol. It is designed to work using the WebUSB API, allowing developers to implement AOA communication within web environments.Use @yume-chan/no-data-view to read/write numbers from Uint8Arrays
mainThe
@yume-chan/no-data-viewpackage provides a set of methods to read and write numbers directly fromUint8Arrays. This approach avoids the memory allocation, performance impact, and GC pressure associated with creating newDataViewinstances for every shortUint8Array.Because these are basic number operations, the performance is nearly identical to native
DataViewmethods, and in some cases (likegetBigUint64andsetBigUint64in Chrome), this implementation is actually faster.Use @yume-chan/media-codec to parse configuration packets
main@yume-chan/media-codec is a library designed to parse configuration packets for H.264, H.265, and AV1 video codecs. It is useful for extracting codec-specific parameters from bitstreams.Access Tango documentation
mainFor detailed technical documentation, API references, and usage guides, visit the official documentation site at https://tangoadb.dev/.Reboot a device to specific modes with @yume-chan/adb-cli
mainUse the
rebootcommand to restart the device. You can specify various modes:bootloaderrecoverysideload(reboots into recovery and automatically starts sideload mode)sideload-auto-reboot(same as sideload but reboots after sideloading)
If no mode is specified, it defaults to booting the system image.
Install @yume-chan/struct
mainInstall the
@yume-chan/structpackage via npm to use its C-style structure serializer and deserializer.$ npm i @yume-chan/structConfigure Web Streams API polyfills in Node.js
mainThe
@yume-chan/stream-extralibrary usesReadableStream,WritableStream, andTransformStreamfromglobalThis. If these are not natively available, it defaults to usingweb-streams-polyfill.In Node.js environments where loading the
stream/webmodule causes compatibility issues with bundlers (like Webpack) or Top Level Await, you can manually assign the streams toglobalThisbefore loading this library:import { WritableStream, ReadableStream, TransformStream } from 'stream/web'; (globalThis as any).WritableStream = WritableStream; (globalThis as any).ReadableStream = ReadableStream; (globalThis as any).TransformStream = TransformStream; // Now load @yume-chan/stream-extraTry Tango online
mainYou can use the Tango application directly in your browser by visiting the official web app at https://tangoapp.dev.