Skip to content

Upload videos from third party applications

Daniel Neto edited this page Feb 27, 2024 · 15 revisions

Uploading Files to AVideo (AVideo) for Third-Party Apps

This tutorial provides step-by-step instructions for third-party applications to upload files to AVideo, ensuring secure authentication and detailed video metadata submission.

Obtaining the Password Hash

To interact with AVideo's API, you'll need to use an encrypted password. This is how you can obtain it:

1. Locate the Encryption Script: Each AVideo installation comes with a script to encode passwords. It can vary, especially if the installation uses a salt for enhanced security. Typically, you would access it like so:

https://yourSite/objects/encryptPass.json.php?pass=YOUR_PASSWORD

Replace yourSite with your AVideo installation URL and YOUR_PASSWORD with the actual password you wish to encrypt.

2. Encrypt Your Password: Navigate to the URL from step 1. This will return your encrypted password in JSON format. For example, using a browser or a tool like curl:

curl https://yourSite/objects/encryptPass.json.php?pass=123

This request returns an encrypted password that looks like this:

{"encrypted_password":"ENCRYPTED_PASSWORD_HERE"}

Uploading the File

To upload files, use the Mobile Plugin Upload File endpoint. Here’s how:

1. Construct the Upload URL: Your URL will include your username and the encrypted password obtained previously:

yourSite/plugin/MobileManager/upload.php?user=USERNAME&pass=ENCRYPTED_PASSWORD

Replace yourSite with your AVideo site URL, USERNAME with your actual username, and ENCRYPTED_PASSWORD with the encrypted password you received.

2. Prepare Your HTML Form: Ensure your form includes inputs for the video file and additional metadata like title, description, categories_id, can_share, and video_password. Here’s an example form:

<form enctype="multipart/form-data" method="post" action="UPLOAD_URL">
    <input name="title" type="text" placeholder="Video Title" /><br>
    <input name="description" type="text" placeholder="Video Description" /><br>
    <input name="categories_id" type="text" placeholder="Category ID" /><br>
    <input name="can_share" type="checkbox" value="1" /> Can Share<br>
    <input name="video_password" type="password" placeholder="Video Password" /><br>
    <input name="upl" type="file" accept="video/*" /><br>
    <input type="submit" value="Upload Video" />
</form>

Replace UPLOAD_URL with the URL constructed for file upload. This form includes fields for video title, description, category ID, sharing permission, and video password.

3. Video Metadata Parameters: Alongside your file, you can send additional metadata for the video using either GET or POST parameters:

  • title: The title of the video.
  • description: A brief description of the video.
  • categories_id: The ID for the video category.
  • can_share: Set this to 1 to allow sharing of the video.
  • video_password: If you wish to protect the video with a password.

Webhooks and Notifications

AVideo supports webhooks through the Notifications Plugin for events like new video uploads. For setup and more details, refer to the Notifications Plugin documentation.

Clone this wiki locally