Skip to content

AVideo Platform API

Daniel Neto edited this page Oct 25, 2024 · 8 revisions

This document provides an overview of the AVideo API, including usage examples and authentication methods. The API enables third-party applications to interact with the AVideo platform. You can use this API to build custom applications or integrate with our mobile application.

1. Enabling the API Plugin

Ensure the API plugin is enabled on your AVideo installation. Access the Info button within the plugin settings to explore available resources. You must have admin privileges to access this information. Here’s an example from the demo site: API Info.

chrome-capture-2023-1-8

2. Authentication

Most API calls require user authentication. You can submit either a raw password or an encoded password:

  • Raw Password: Use the plain password directly.

  • Encoded Password: Use a hashed password. Password hashes are unique per website. To generate a hash for a password, you can use the encryptPass endpoint. Example:

    https://demo.avideo.com/objects/encryptPass.json.php?pass=123
    

The response will provide the hash:

{
    "hash": "f321d14cdeeb7cded7489f504fa8862b"
}

Example API Calls

  • Raw Password:

    https://demo.avideo.com/plugin/API/get.json.php?APIName=signIn&user=admin&pass=123
    
  • Encoded Password:

    https://demo.avideo.com/plugin/API/get.json.php?APIName=signIn&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
    

3. Uploading Videos

The API allows you to upload videos from third-party applications. The Streamer handles all security, permissions, and encoding tasks. Follow the detailed guide for uploading videos to learn how to set up video uploads.

4. Sample API Call Video Response

Below is an example output from calling the API:

https://demo.avideo.com/plugin/API/get.json.php?APIName=video&catName=default&rowCount=1
{
    "error": false,
    "message": "",
    "response": {
        "rowCount": 1,
        "totalRows": 60,
        "rows": [
            {
                "id": 7618408,
                "isLive": 1,
                "categories_id": 1,
                "description": "",
                "user": "movieclips",
                "name": "Daniel Neto",
                "email": "movies@youphptube.com",
                "isAdmin": 0,
                "photoURL": "videos/userPhoto/photo5.png",
                "canStream": 1,
                "canUpload": 1,
                "channelName": "MovieclipsTrailers",
                "emailVerified": 1,
                "views_count": 0,
                "rrating": "",
                "users_id": 5,
                "type": "Live",
                "title": "‌Live 24 hours",
                "clean_title": "zwnj-live-24-hours",
                "poster": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "thumbsJpgSmall": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "href": "https://demo.avideo.com/live/0/MovieclipsTrailers",
                "link": "https://demo.avideo.com/live/0/MovieclipsTrailers",
                "imgGif": "",
                "className": "live_0_5c5d5402641e9",
                "galleryCallback": "",
                "stats": {
                    "type": "live",
                    "photo": "https://demoavideocom.cdn.ypt.me/videos/userPhoto/photo5.png?cache=1675861349_1675861447",
                    "UserPhoto": "https://demoavideocom.cdn.ypt.me/videos/userPhoto/photo5.png?cache=1675861349_1675861447",
                    "title": "‌Live 24 hours",
                    "users_id": 5,
                    "name": "Movieclips Trailers",
                    "href": "https://demo.avideo.com/live/0/MovieclipsTrailers",
                    "link": "https://demo.avideo.com/live/0/MovieclipsTrailers",
                    "callback": "",
                    "poster": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "imgGif": "",
                    "categories_id": 1,
                    "className": "live_0_5c5d5402641e9",
                    "comingsoon": false,
                    "description": false,
                    "timezone": "America/Sao_Paulo",
                    "live_servers_id": 0,
                    "key": "5c5d5402641e9",
                    "isPrivate": false,
                    "isPasswordProtected": false,
                    "method": "Live::_getStats"
                },
                "embedlink": "https://demo.avideo.com/live/0/MovieclipsTrailers?embed=1",
                "images": {
                    "poster": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterPortrait": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterPortraitPath": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterPortraitThumbs": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterPortraitThumbsSmall": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "thumbsGif": "",
                    "gifPortrait": "",
                    "thumbsJpg": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "thumbsJpgSmall": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "spectrumSource": false,
                    "posterLandscape": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterLandscapePath": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterLandscapeThumbs": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                    "posterLandscapeThumbsSmall": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg"
                },
                "videos": {
                    "m3u8": {
                        "url": "https://demoavideocomlive.cdn.ypt.me/5c5d5402641e9/index.m3u8",
                        "url_noCDN": "https://demoavideocomlive.cdn.ypt.me/5c5d5402641e9/index.m3u8",
                        "type": "video",
                        "format": "m3u8",
                        "resolution": "auto"
                    }
                },
                "Poster": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "Thumbnail": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "createdHumanTiming": "Live",
                "videoLink": "",
                "next_videos_id": null,
                "isSuggested": 0,
                "trailer1": "",
                "trailer2": "",
                "trailer3": "",
                "total_seconds_watching": 0,
                "duration": "Live",
                "duration_in_seconds": 0,
                "likes": 0,
                "dislikes": 0,
                "users_id_company": null,
                "iconClass": "fa fa-folder",
                "category": "Default",
                "clean_category": "default",
                "category_description": "",
                "videoCreation": "2023-02-08 11:13:47",
                "videoModified": "2023-02-08 11:13:47",
                "groups": [],
                "tags": [],
                "videoTags": [
                    {
                        "type_name": "Starring",
                        "name": ""
                    },
                    {
                        "type_name": "Language",
                        "name": "English"
                    },
                   ...
                ],
                "videoTagsObject": {
                    "Starring": [],
                    "Language": [
                        "English"
                    ],
                    "Release_Date": [
                        "2023"
                    ],
                    "Running_Time": [
                        "0"
                    ],
                    "Genres": [
                        "Default"
                    ]
                },
                "descriptionHTML": "",
                "progress": {
                    "percent": 0,
                    "lastVideoTime": 0
                },
                "isFavorite": null,
                "isWatchLater": null,
                "favoriteId": null,
                "watchLaterId": null,
                "total_seconds_watching_human": "",
                "views_count_short": "",
                "identification": "Movieclips Trailers",
                "UserPhoto": "videos/userPhoto/photo5.png",
                "isSubscribed": true,
                "subtitles": [],
                "subtitlesSRT": [],
                "comments": [],
                "commentsTotal": 0,
                "subscribers": 1,
                "relatedVideos": [],
                "wwbnURL": "https://demo.avideo.com/live/0/MovieclipsTrailers",
                "wwbnEmbedURL": "https://demo.avideo.com/live/0/MovieclipsTrailers?embed=1",
                "wwbnImgThumbnail": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "wwbnImgPoster": "https://demo.avideo.com/plugin/Live/getImage.php?live_servers_id=0&playlists_id_live=&live_index=&u=movieclips&format=jpg",
                "wwbnTitle": "‌Live 24 hours",
                "wwbnDescription": "",
                "wwbnChannelURL": "https://demo.avideo.com/channel/TheAdminChannel",
                "wwbnImgChannel": "https://demoavideocom.cdn.ypt.me/videos/userPhoto/photo1.png?cache=1675861349_1675861447",
                "wwbnType": "live"
            },
            ...
        ],
        "current": 1,
        "hasMore": true
    },
    "msg": "",
    "users_id": 1
}

5. Collecting Video and Ad Play Statistics

To implement and collect statistics, you can follow the detailed Developer Guide: Collecting Video and Ad Play Statistics. This guide covers how to:

  • Track how many times each video is played.
  • Monitor how long each user watches a video and capture their last viewing position.
  • Record ad play events to generate reports.
  • Implement these features for different platforms, including web, mobile, and other devices.

Important Details

  • Video Statistics: Collects data on user interactions with videos, such as total play count, watch duration, and last watched position. Ensure you configure your API calls to send this data correctly.
  • Ad Statistics: Requires tracking ad events such as impressions, clicks, and completions. Integration can vary based on the platform (e.g., web, mobile).

6. Additional Resources

Clone this wiki locally