This document provides a comprehensive guide for developers looking to integrate the aPlayer application into their own systems, whether they are mobile applications (iOS/Android) or websites. aPlayer offers seamless video playback, offline content management, and shortcut functionalities via app links.
aPlayer leverages deep linking (App Links) to enable external applications or websites to trigger specific functionalities within the aPlayer app. This allows for a smooth and integrated user experience.
All app links follow a base URL structure:
https://aplayer.co/appLink/
This functionality allows you to add a new shortcut (addShortcut) to the aPlayer home screen or open an existing one (openShortcut).
https://aplayer.co/appLink/addShortcut?title={TITLE}&url={URL}&mode={MODE}
https://aplayer.co/appLink/openShortcut?title={TITLE}&url={URL}&mode={MODE}
TITLE (required) : The title of the shortcut. URL-encoded.
URL (required) : The URL that the shortcut will open when tapped. This can be any valid web URL or another app link. URL-encoded.
MODE (optional) :
https://aplayer.co/appLink/addShortcut?title=Google&url=https://google.com&mode=app
This functionality allows you to initiate video playback (playVideo) or trigger the download of video content for offline viewing (offlineVideo) directly within the aPlayer app. Both functions share the same app link format and parameters.
https://aplayer.co/appLink/playVideo?title={TITLE}&description={DESCRIPTION}&poster={POSTER}&source={SOURCE}&key={KEY}
https://aplayer.co/appLink/offlineVideo?title={TITLE}&description={DESCRIPTION}&poster={POSTER}&source={SOURCE}&key={KEY}
TITLE (required) : The title of the video to be displayed in the player.
DESCRIPTION (optional) : A brief description of the video.
POSTER (optional) : URL to an image that will be displayed as the video's poster (thumbnail) before playback begins.
SOURCE (required) : Encrypted JSON string containing the video's actual source URL, format, subtitles, and optional headers.
KEY (required) : Encrypted AES secret key used to encrypt the source parameter.
https://aplayer.co/appLink/addShortcut?title=Google&url=https://google.com&mode=app
For security reasons, the source and key parameters are encrypted using a combination of AES and RSA algorithms.
The source data (which is a JSON string) is encrypted using AES (Advanced Encryption Standard) with
the
AES/ECB/PKCS5Padding
mode and a 128-bit secret key that you (the integrator) define. This
ensures that
the video's actual URL and related sensitive information are protected.
JSON Format for source data:
The AES secret key (which you used to encrypt the source data) is then encrypted
using RSA (Rivest–Shamir–Adleman) with the RSA/ECB/PKCS1Padding
mode and a 2048-bit key
pair using our
public key. This allows the APlayer app to securely decrypt your AES secret key and subsequently
decrypt
the source data.
Our Public RSA Key:
This section provides code examples in Javascript to help you implement the AES data
encryption and RSA key encryption as
required for the playVideo
and offlineVideo
app links.
AES Encryption (for source data):
RSA Encryption (for AES key):