Skip to content

feat: Expose startDownload API#50

Merged
syed-tp merged 4 commits intomainfrom
expose/start_download_api
Mar 5, 2026
Merged

feat: Expose startDownload API#50
syed-tp merged 4 commits intomainfrom
expose/start_download_api

Conversation

@syed-tp
Copy link
Contributor

@syed-tp syed-tp commented Mar 3, 2026

Clients needed a way to manually trigger video downloads from their own custom UI, outside of the standard player interface. This change bridges the native startDownload functionality to JavaScript so developers can fully control when and how downloads are initiated, while maintaining support for advanced native features like the resolution picker dialog.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new public API that enables external clients to programmatically initiate video downloads. This enhancement provides developers with the flexibility to integrate download functionality into their custom UIs, moving beyond the standard player interface while still supporting advanced native features like resolution selection. The changes span both Android and iOS native modules, along with the corresponding TypeScript definitions, to ensure a unified and controllable download experience.

Highlights

  • Exposed startDownload API: A new startDownload API has been exposed to allow clients to manually trigger video downloads from custom user interfaces, providing greater control over the download process.
  • Android Implementation: The Android native module now includes a startDownload method, which handles video ID, access token, resolution, and metadata, leveraging a new JSON utility for parsing.
  • iOS Implementation: The iOS native module has been updated to declare and provide a placeholder implementation for the startDownload method, bridging it to the React Native environment.
  • Cross-platform API: The startDownload function is now available in the TypeScript interface, ensuring a consistent cross-platform API for initiating downloads.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • android/src/main/java/com/tpstreams/JsonUtils.kt
    • Added a new utility function jsonStringToMap to convert a JSON string into a Kotlin Map, improving JSON parsing consistency.
  • android/src/main/java/com/tpstreams/TPStreamsDownloadModule.kt
    • Imported ReadableMap for handling map-like data from React Native.
    • Implemented the startDownload React Native method, which orchestrates the native download process using the DownloadClient and the new JsonUtils.jsonStringToMap for metadata.
  • android/src/main/java/com/tpstreams/TPStreamsRNPlayerViewManager.kt
    • Refactored the setDownloadMetadata method to utilize the newly introduced JsonUtils.jsonStringToMap for parsing download metadata, simplifying the code and centralizing JSON handling.
  • ios/TPStreamsDownloadModule.mm
    • Declared the startDownload method using RCT_EXTERN_METHOD to expose it to the React Native bridge, allowing JavaScript to call this native function.
  • ios/TPStreamsDownloadModule.swift
    • Added a placeholder implementation for the startDownload method, ensuring the method is available for the React Native bridge while awaiting full native logic.
  • src/TPStreamsDownload.tsx
    • Exported a new startDownload function that serves as the JavaScript interface for calling the native startDownload module method, passing video details and metadata.
  • src/index.tsx
    • Re-exported the startDownload function from TPStreamsDownload.tsx to make it part of the main public API surface.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request exposes a startDownload API to JavaScript, allowing for custom download UI. The Android implementation is mostly complete, but I've noted a couple of areas for improvement regarding efficiency and robustness in handling metadata and exceptions. The most critical issue is that the iOS implementation is currently a stub and will not work as expected, which should be addressed before merging. The changes in TypeScript and for exporting the new function look good.

@syed-tp syed-tp merged commit dbd26c5 into main Mar 5, 2026
7 checks passed
@syed-tp syed-tp deleted the expose/start_download_api branch March 5, 2026 10:50
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.

1 participant