### Initialize VdoPlayer
Source: https://www.vdocipher.com/docs/mobile/android/getting-started
Initialize the player instance using the fragment and an InitializationListener to handle the setup process.
```java
playerFragment.initialize(initializationListener);
```
```kotlin
playerFragment.initialize(initializationListener)
```
--------------------------------
### Sample Configurations
Source: https://www.vdocipher.com/docs/server/playbackauth/ipgeo
Examples of various access control rules that can be configured.
```APIDOC
## Sample Configurations
Most of your use-case will fall among one of the below listed requirements. You can modify the samples below to suit your specifications. If you need help making any custom rule or you just like us to verify the rule, feel free to email our support at support@vdocipher.com
### Allow only specific IP
```json
{
"allow": ["ip1"]
}
```
### Block set of countries
```json
{
"block": ["c1", "c2", "c3"]
}
```
### Allow only a set of countries
```json
{
"allow": ["c1", "c2", "c3"]
}
```
### Block specific IP
```json
{
"block": ["ip1"]
}
```
### Allow one country and one IP wherever it is
```json
{
"allow": ["ip1", "c1"]
}
```
### Block set of countries except one IP
```json
{
"block": ["c1", "c2"],
"except": ["ip1"]
}
```
### Allow specific IP when it is among set of countries
```json
{
"allow": [["ip1", "c1", "c2", "c3"]]
}
```
### Allow specific IP unless it is among set of countries
```json
{
"allow": ["ip1"],
"except": ["c1", "c2", "c3"]
}
```
### Allow set of countries and block set of IPs wherever they are from
```json
{
"allow": ["c1", "c2", "c3"],
"except": ["ip1", "ip2", "ip3"]
}
```
```
--------------------------------
### Implement InitializationListener for VdoPlayer
Source: https://www.vdocipher.com/docs/mobile/android/getting-started
Defines the InitializationListener to handle player setup, including loading media via VdoInitParams upon success. It provides callbacks for initialization success, failure, and de-initialization.
```Java
PlayerHost.InitializationListener initializationListener = new PlayerHost.InitializationListener() {
@Override
public void onInitializationSuccess(PlayerHost playerHost, VdoPlayer vdoPlayer, boolean wasRestored) {
VdoInitParams vdoInitParams = new VdoInitParams.Builder()
.setOtp("REPLACE WITH YOUR OTP")
.setPlaybackInfo("REPLACE WITH YOUR PLAYBACK INFO")
.build();
vdoPlayer.load(vdoInitParams);
}
@Override
public void onInitializationFailure(PlayerHost playerHost, ErrorDescription errorDescription) {
}
@Override
public void onDeInitializationSuccess() {
}
};
```
```Kotlin
val initializationListener = object : PlayerHost.InitializationListener {
override fun onInitializationSuccess(playerHost: PlayerHost, vdoPlayer: VdoPlayer, wasRestored: Boolean) {
val vdoInitParams = VdoInitParams.Builder()
.setOtp("REPLACE WITH YOUR OTP")
.setPlaybackInfo("REPLACE WITH YOUR PLAYBACK INFO")
.build()
vdoPlayer.load(vdoInitParams)
}
override fun onInitializationFailure(playerHost: PlayerHost, errorDescription: ErrorDescription) {
}
override fun onDeInitializationSuccess() {
}
}
```
--------------------------------
### GET /hooks/
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of all configured web hooks.
```APIDOC
## GET /hooks/
### Description
Retrieves all web hooks associated with the account.
### Method
GET
### Endpoint
/hooks/
### Response
#### Success Response (200)
- **hooks** (array) - List of hook objects.
#### Response Example
[
{
"id": "hook_123",
"url": "https://example.com/webhook"
}
]
```
--------------------------------
### GET /policy
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of all defined license policies.
```APIDOC
## GET /policy
### Description
Fetches all license policies available in the account.
### Method
GET
### Endpoint
/policy
### Response
#### Success Response (200)
- **policies** (array) - List of license policy objects.
#### Response Example
{
"policies": []
}
```
--------------------------------
### Install VdoCipher React Native SDK
Source: https://www.vdocipher.com/docs/mobile/react-native/getting-started
Installs the VdoCipher React Native bridge package using npm. This is the first step to integrate the SDK into your project.
```bash
npm install vdocipher-rn-bridge --save
```
--------------------------------
### Integrate Player View Controller with UI Controls
Source: https://www.vdocipher.com/docs/mobile/ios/getting-started
Code examples demonstrating how to get and present the VdoCipher player view controller with built-in UI controls. This is presented as the fastest and easiest way to integrate the player.
```swift
let vdoPlayerController: UIViewController = VdoCipher.getVdoPlayerViewController()
self.present(vdoPlayerController, animated: true)
```
```swift
self.navigationController?.pushViewController(vdoPlayerController, animated: true)
```
--------------------------------
### GET /license-policies
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of all existing license policies.
```APIDOC
## GET /license-policies
### Description
Fetches a comprehensive list of all license policies defined for the account.
### Method
GET
### Endpoint
/license-policies
### Response
#### Success Response (200)
- **policies** (array) - List of license policy objects
```
--------------------------------
### Complete Vdocipher Implementation
Source: https://www.vdocipher.com/docs/player/v2/api-reference/accessing-player
A full example demonstrating the HTML structure, script loading, player initialization, and usage of both DOM and custom Vdocipher APIs.
```html
```
--------------------------------
### VdoAsset: Start Download with Token
Source: https://www.vdocipher.com/docs/mobile/ios/api-reference
Initiates the download of a VdoAsset using an authentication token. Supports specifying the desired video quality for the download.
```swift
func startDownload(token: String, videoQuality: VdoFramework.VdoAsset.VideoQuality? = nil)
```
--------------------------------
### VdoAsset: Start Download with OTP
Source: https://www.vdocipher.com/docs/mobile/ios/api-reference
Initiates the download of a VdoAsset using an OTP and playback information. Allows specifying the desired video quality for the download.
```swift
func startDownload(otp: String, playbackInfo: String, videoQuality: VideoQuality? = nil)
```
--------------------------------
### GET /videos
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of videos with optional filtering by page, limit, and tags.
```APIDOC
## GET /videos
### Description
Search and list videos stored in the account.
### Method
GET
### Endpoint
/videos
### Parameters
#### Query Parameters
- **page** (number) - Optional - Page number for pagination (default: 1).
- **limit** (number) - Optional - Number of results per page (default: 20).
- **tags** (string) - Optional - Comma separated tags to filter videos.
### Response
#### Success Response (200)
- **videos** (array) - List of video objects.
### Response Example
{
"videos": []
}
```
--------------------------------
### GET /videos/{videoId}/files/{fileId}
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Downloads a specific file associated with a video. Download permission must be activated on the account for this to work.
```APIDOC
## GET /videos/{videoId}/files/{fileId}
### Description
Download a file. Download permission must be activated on the account for this to work.
### Method
GET
### Endpoint
/videos/{videoId}/files/{fileId}
### Parameters
#### Path Parameters
- **videoId** (string) - Required - The ID of the video the file belongs to.
- **fileId** (string) - Required - The ID of the file to download.
### Response
#### Success Response (200)
- **(file content)** - The content of the requested file.
#### Response Example
(Binary file content will be returned, not a JSON example.)
```
--------------------------------
### Clone and Run Example React Native App
Source: https://www.vdocipher.com/docs/mobile/react-native/getting-started
Steps to clone and run the VdoCipher sample React Native application. This is useful for testing the SDK's functionality and exploring its features.
```bash
mkdir sample-react-native-app && cd sample-react-native-app
git clone https://github.com/VdoCipher/sample-react-native-app.git .
npm install
npx react-native run-android
```
--------------------------------
### Configure VdoPlayerUIFragment XML
Source: https://www.vdocipher.com/docs/mobile/android/getting-started
Example XML configuration for the VdoPlayerUIFragment, including the custom attribute to disable default back-press handling.
```XML
```
--------------------------------
### POST /hooks/
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Creates a new web hook configuration.
```APIDOC
## POST /hooks/
### Description
Creates a new web hook to receive event notifications.
### Method
POST
### Endpoint
/hooks/
### Request Body
- **url** (string) - Required - The callback URL for the hook.
### Request Example
{
"url": "https://example.com/callback"
}
### Response
#### Success Response (200)
- **id** (string) - The unique identifier of the created hook.
#### Response Example
{
"id": "hook_456"
}
```
--------------------------------
### Initialize VdoPlayerView Reference
Source: https://www.vdocipher.com/docs/mobile/react-native/getting-started
Demonstrates how to create a reference to the VdoPlayerView component, which is required to invoke player methods.
```javascript
this._player = player} />
```
--------------------------------
### Get OTP with Annotations using Node.js
Source: https://www.vdocipher.com/docs/server/playbackauth/anno
This Node.js example demonstrates how to obtain an OTP from VdoCipher using the 'request' library. It constructs a POST request with the necessary headers and a JSON body containing annotation details. The annotation is stringified before being sent.
```javascript
var request = require('request');
var options = {
method: 'POST',
url: 'https://dev.vdocipher.com/api/videos/1234567890/otp',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Apisecret a1b2c3d4e5',
},
body: {
annotate: JSON.stringify([
{
type: 'rtext',
text: '{name}',
alpha: '0.60',
color: '0xFF0000',
size: '15',
interval: '5000',
},
]),
},
json: true,
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
```
--------------------------------
### Get OTP with Annotations using C#
Source: https://www.vdocipher.com/docs/server/playbackauth/anno
This C# example uses RestSharp to interact with the VdoCipher API. It demonstrates setting up an authenticated client, defining OTP parameters including JSON-serialized annotations, and making a POST request to the OTP endpoint. Error handling for API response is included.
```csharp
var client = new RestClient("https://dev.vdocipher.com") {
// using user secrets to keep api key
Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(_config["VdoApiKey"], "Apisecret")
};
var otpParameters = new
{
// 5 minutes until OTP is used
// only used when setting up offline, not again
ttl = 300,
// watermark specified below. there can be more
// than one object in this array
annotate= JsonSerializer.Serialize(new [] {new {
type= "rtext",
text= "I am a moving text on video",
alpha= "0.60",
color= "0xFF0000",
size= "15",
interval= "5000",
}})
};
Debug.Assert(videoId?.Length == 32, "videoId is not valid");
var url = $"/api/videos/{videoId}/otp";
var request = new RestRequest(url).AddJsonBody(otpParameters);
var cancellationToken = CancellationToken.None;
var response = await client.ExecutePostAsync(request, cancellationToken);
if (response.Content == null) return Json(new {message= "Invalid API response"});
var otpObject = JsonSerializer.Deserialize>(response.Content);
//otpObject contain {otp: string, playbackInfo: string}
return Json(otpObject);
```
--------------------------------
### Load Playlist and Initialize Player for VdoCipher (Kotlin)
Source: https://www.vdocipher.com/docs/mobile/android/examples/playlist
Loads media items into a playlist and submits them to the RecyclerView adapter, then initializes the VdoPlayerUIFragment using a provided listener in Kotlin. This prepares the player for video playback.
```kotlin
private fun loadPlaylist() {
// Add media items to the playlist
mediaItems.addAll(PlaylistHolder().getMediaItems())
// Submit the playlist to the RecyclerView adapter
videoAdapter.submitList(ArrayList(mediaItems))
// Initialize the player fragment
newFragment.initialize(initializationListener)
}
```
--------------------------------
### GET /videos
Source: https://www.vdocipher.com/docs/server/videomanagement/listing
Retrieves a paginated list of videos with their associated metadata, status, and poster information.
```APIDOC
## GET /videos
### Description
Retrieves a list of videos. The response includes the total count and an array of video objects containing details like ID, title, length, and encoding status.
### Method
GET
### Endpoint
/videos
### Parameters
#### Query Parameters
- **page** (integer) - Optional - The page number for pagination.
- **limit** (integer) - Optional - Number of items per page (max 40).
- **tags** (string) - Optional - Filter videos by associated tags.
### Request Example
GET /videos?page=1&limit=10
### Response
#### Success Response (200)
- **count** (integer) - Total number of videos matching filters.
- **rows** (array) - List of video objects.
#### Response Example
{
"count": 3,
"rows": [
{
"id": "video_123",
"title": "Sample Video",
"description": "Video description",
"upload_time": 1625097600,
"length": 300,
"status": "ready",
"posters": [
{ "width": 854, "height": 480, "posterUrl": "url_1" }
],
"tags": ["demo"]
}
]
}
```
--------------------------------
### GET /api/videos
Source: https://www.vdocipher.com/docs/server/videomanagement/listing
Retrieves a paginated list of videos from the VdoCipher account, with options to filter results by search query, tags, or folder.
```APIDOC
## GET /api/videos
### Description
Fetch a list of all videos associated with the account. The response is paginated by default (20 results per page).
### Method
GET
### Endpoint
`https://dev.vdocipher.com/api/videos`
### Parameters
#### Query Parameters
- **page** (integer) - Optional - The page number to retrieve.
- **limit** (integer) - Optional - Number of results per request (default 20).
- **tags** (string) - Optional - Comma-separated list of tags to filter videos.
- **q** (string) - Optional - Search term for video ID or title.
- **folderId** (string) - Optional - Filter by a specific folder ID (use 'root' for top-level).
### Request Example
`GET https://dev.vdocipher.com/api/videos?page=1&limit=40`
### Response
#### Success Response (200)
- **videos** (array) - List of video objects.
#### Response Example
{
"videos": [
{
"id": "video_id_1",
"title": "Sample Video"
}
]
}
```
--------------------------------
### Initialize Video Upload in Python
Source: https://www.vdocipher.com/docs/server/upload/file
Initializes the video upload process by requesting an upload URL from the VdoCipher API using an authorization secret.
```Python
import json
import requests
from requests_toolbelt import MultipartEncoder
api_secret_key = "________ENTER KEY HERE"
querystring = {"title":"_________ENTER VIDEO TITLE_______", "upload": "true"}
url = "https://dev.vdocipher.com/api/videos"
headers = {
'Authorization': "Apisecret " + api_secret_key
}
response = requests.request("PUT", url, headers=headers, params=querystring)
uploadInfo = response.json()
clientPayload = uploadInfo['clientPayload']
uploadLink = clientPayload['uploadLink']
```
--------------------------------
### Android Activity Setup for VdoCipher Playlist (Kotlin)
Source: https://www.vdocipher.com/docs/mobile/android/examples/playlist
Sets up the VdoPlayerUIFragment for video playback and a RecyclerView to display the video playlist in an Android Activity using Kotlin. It initializes the layout, RecyclerView, and adapter, then loads the playlist.
```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_vdo_playlist)
// Setup Player Fragment for video playback
newFragment = supportFragmentManager.findFragmentById(R.id.vdo_player_ui_fragment) as VdoPlayerUIFragment
// Setup RecyclerView for displaying the playlist
val recyclerView = findViewById(R.id.recycler_view)
recyclerView.layoutManager = LinearLayoutManager(this)
recyclerView.addItemDecoration(DividerItemDecoration(recyclerView.context, LinearLayoutManager.VERTICAL))
// Set adapter to manage playlist items
videoAdapter = VideoAdapter(this)
recyclerView.adapter = videoAdapter
// Load the playlist and initialize the player
loadPlaylist()
}
```
--------------------------------
### Install VdoCipher SDK using CocoaPods
Source: https://www.vdocipher.com/docs/mobile/ios/getting-started
Steps to integrate the VdoCipher SDK into your project using CocoaPods. This involves adding the 'VdoFramework' pod to your Podfile, running 'pod install', and then importing the framework into your Swift files.
```ruby
pod 'VdoFramework'
```
```swift
import VdoFramework
```
--------------------------------
### POST /license-policies
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Creates a new license policy with specified security and playback configurations.
```APIDOC
## POST /license-policies
### Description
Creates a new license policy object containing settings for TTL, watermarking, and domain restrictions.
### Method
POST
### Endpoint
/license-policies
### Request Body
- **name** (string) - Required - The name of the license policy
- **ttl** (integer) - Optional - Time to live in seconds (default: 300)
- **rentalDuration** (integer) - Optional - Duration of rental in seconds
- **watermarkTemplate** (array) - Optional - List of watermark configurations
- **geoEffect** (string) - Optional - Geo-blocking effect type
- **geoList** (array) - Optional - List of country codes
- **domainWhitelistValues** (array) - Optional - List of allowed hostnames
### Response
#### Success Response (200)
- **id** (string) - Unique identifier of the policy
- **name** (string) - Name of the policy
- **createdAt** (string) - ISO8601 timestamp
- **updatedAt** (string) - ISO8601 timestamp
```
--------------------------------
### POST /otp
Source: https://www.vdocipher.com/docs/server/playbackauth/reqbody
Configures security and metadata parameters for a video playback OTP request.
```APIDOC
## POST /otp
### Description
Configures optional security and analytics parameters for generating a video playback OTP.
### Method
POST
### Endpoint
/otp
### Parameters
#### Request Body
- **ttl** (integer) - Optional - Time-to-live for OTP validity in seconds.
- **annotation_code** (string) - Optional - Custom annotation code for the video session.
- **url_whitelist** (array) - Optional - List of allowed domains for playback.
- **ip_rules** (object) - Optional - IP-based access control rules.
- **geo_rules** (object) - Optional - Geographic restriction rules.
- **viewer_id** (string) - Optional - Unique identifier for viewer-based analytics.
### Request Example
{
"ttl": 300,
"url_whitelist": ["example.com"],
"viewer_id": "user_123"
}
### Response
#### Success Response (200)
- **otp** (string) - The generated OTP string for video playback.
#### Response Example
{
"otp": "vdocipher_otp_string_here"
}
```
--------------------------------
### POST /policy
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Creates a new license policy.
```APIDOC
## POST /policy
### Description
Creates a new license policy for video content protection.
### Method
POST
### Endpoint
/policy
### Request Body
- **name** (string) - Required - Name of the policy.
### Request Example
{
"name": "Standard Protection"
}
### Response
#### Success Response (200)
- **id** (string) - The ID of the created policy.
#### Response Example
{
"id": "pol_789"
}
```
--------------------------------
### GET /videos/{videoId}/params
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves specific parameter values for a video.
```APIDOC
## GET /videos/{videoId}/params
### Description
Retrieves specific parameter values for a video based on provided keys.
### Method
GET
### Endpoint
/videos/{videoId}/params
### Parameters
#### Path Parameters
- **videoId** (string) - Required - The unique identifier of the video.
#### Query Parameters
- **keys** (string) - Required - CSV value of keys to retrieve.
### Response
#### Success Response (200)
- **values** (array) - List of parameter values.
#### Response Example
[
"value1",
"value2"
]
```
--------------------------------
### GET /videos/{videoId}/chapters
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves the list of chapters associated with a specific video.
```APIDOC
## GET /videos/{videoId}/chapters
### Description
Fetch all chapters defined for the specified video.
### Method
GET
### Endpoint
/videos/{videoId}/chapters
### Parameters
#### Path Parameters
- **videoId** (string) - Required - The unique identifier of the video.
### Response
#### Success Response (200)
- **ChapterList** (Array) - A list of chapter objects.
#### Response Example
{
"chapters": [{"time": 0, "title": "Intro"}]
}
```
--------------------------------
### Implement Playback Delegate for Player Events
Source: https://www.vdocipher.com/docs/mobile/ios/getting-started
Swift code demonstrating how to implement the playback delegate methods to listen for player setup events. This includes handling when the player is ready to play, when the current item changes, and when a stream load error occurs.
```swift
extension ViewController {
func streamPlaybackManager(playerReadyToPlay player: AVPlayer) {
// player is ready to play
player.play()
}
func streamPlaybackManager(playerCurrentItemDidChange player: AVPlayer) {
/// player current item has changed, use this to set to destination from Step 0, only in case if you are using default `AVPlayerViewController` with default controls for playback.
playerViewController.player = player
}
func streamLoadError(error: VdoError) {
// Error occured while initiating playback
}
}
```
```swift
VdoCipher.setPlaybackDelegate(delegate: self)
```
--------------------------------
### Load Playlist and Initialize Player for VdoCipher (Java)
Source: https://www.vdocipher.com/docs/mobile/android/examples/playlist
Loads media items into a playlist and submits them to the RecyclerView adapter, then initializes the VdoPlayerUIFragment using a provided listener in Java. This prepares the player for video playback.
```java
private void loadPlaylist() {
// Add media items to the playlist
mediaItems.addAll(new PlaylistHolder().getMediaItems());
// Submit the playlist to the RecyclerView adapter
videoAdapter.submitList(new ArrayList<>(mediaItems));
// Initialize the player fragment
newFragment.initialize(initializationListener);
}
```
--------------------------------
### Get Video Information using PHP
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This PHP script utilizes cURL to make an HTTP GET request to the VdoCipher meta API. It retrieves video metadata, including poster image URLs, and outputs the response. Remember to substitute {{videoID}} with the relevant video identifier.
```php
"https://dev.vdocipher.com/api/meta/{{videoID}}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
```
--------------------------------
### GET /videos/{videoId}
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves detailed information about a specific video using its unique identifier.
```APIDOC
## GET /videos/{videoId}
### Description
Fetch detailed metadata and information for a specific video.
### Method
GET
### Endpoint
/videos/{videoId}
### Parameters
#### Path Parameters
- **videoId** (string) - Required - The unique identifier of the video.
### Response
#### Success Response (200)
- **Video** (Object) - The video details object.
#### Response Example
{
"id": "video_123",
"title": "Sample Video"
}
```
--------------------------------
### POST /api/otp
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Generates an OTP for secure video playback with configurable security rules.
```APIDOC
## POST /api/otp
### Description
Generates a playback OTP based on provided security parameters such as TTL, bitrate, and geo-blocking rules.
### Method
POST
### Endpoint
/api/otp
### Parameters
#### Request Body
- **ttl** (integer) - Required - Time to live for the OTP in seconds
- **forcedBitrate** (integer) - Required - Bitrate constraint
- **annotate** (string) - Required - Annotation text
- **nocdn** (integer) - Required - Disable CDN flag
- **whitelisthref** (string) - Required - Allowed domain whitelist
- **ipGeoRules** (string) - Required - IP-based geo-restriction rules
### Request Example
{
"ttl": 300,
"forcedBitrate": 1000,
"annotate": "user@example.com",
"nocdn": 0,
"whitelisthref": "https://example.com",
"ipGeoRules": "{\"allowed\": [\"US\"]}"
}
### Response
#### Success Response (200)
- **otp** (string) - The generated playback OTP
#### Response Example
{
"otp": "abc123xyz"
}
```
--------------------------------
### Get Video Information using Python
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This Python script uses the 'requests' library to perform an HTTP GET request to the VdoCipher meta API. It retrieves video metadata, including poster image URLs, and prints the response text. Ensure you replace {{videoID}} with the actual video ID.
```python
import requests
url = "https://dev.vdocipher.com/api/meta/{{videoID}}"
headers = {
'Accept': "application/json"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
```
--------------------------------
### Get Video Information using C#
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This C# code snippet demonstrates how to fetch video information using the RestSharp library. It sends an HTTP GET request to the VdoCipher meta API endpoint, specifying the 'Accept: application/json' header. Replace {{videoID}} with your video's unique identifier.
```csharp
var client = new RestClient("https://dev.vdocipher.com/api/meta/{{videoID}}");
var request = new RestRequest(Method.GET);
request.AddHeader("Accept", "application/json");
IRestResponse response = client.Execute(request);
```
--------------------------------
### Allow One Country and One IP Configuration
Source: https://www.vdocipher.com/docs/server/playbackauth/ipgeo
This configuration allows access from a specific IP address and a specific country. Replace 'ip1' and 'c1' with the actual values.
```json
{
"allow": ["ip1", "c1"]
}
```
--------------------------------
### GET /videos/{videoId}/files
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of files associated with a specific video, including their properties.
```APIDOC
## GET /videos/{videoId}/files
### Description
Get a list of files and their properties for a specific video.
### Method
GET
### Endpoint
/videos/{videoId}/files
### Parameters
#### Path Parameters
- **videoId** (string) - Required - The ID of the video whose files are to be listed.
### Response
#### Success Response (200)
- **(array)** - An array of video file objects. Each object contains file properties.
#### Response Example
```json
[
{
"fileId": "file_123",
"fileName": "poster.jpg",
"fileType": "poster"
},
{
"fileId": "file_456",
"fileName": "subtitles.srt",
"fileType": "subtitle"
}
]
```
```
--------------------------------
### Initiate Video Playback with VdoViewManager
Source: https://www.vdocipher.com/docs/mobile/ios/swiftUI
Call the initiatePlayback method on your VdoViewManager instance to start video playback. This method takes a completion handler that provides the PlayerView and any potential errors. Handle errors by checking the 'err' parameter and update your UI accordingly.
```swift
viewManager.initiatePlayback { playerView, err in
if let err = err {
self.message = err.message
return
}
guard let pView = playerView else {return}
self.playerView = pView
self.playerView?.player.play()
}
```
--------------------------------
### GET /api/hooks/
Source: https://www.vdocipher.com/docs/server/account/hooks
Retrieves a list of all configured webhooks for the account.
```APIDOC
## GET /api/hooks/
### Description
List all registered webhooks associated with the account.
### Method
GET
### Endpoint
https://dev.vdocipher.com/api/hooks/
### Request Example
curl -i https://dev.vdocipher.com/api/hooks/ -H 'authorization: Apisecret __________' -H 'content-type: application/json'
### Response
#### Success Response (200)
- **hooks** (array) - List of webhook objects.
```
--------------------------------
### Allow Set of Countries and Block Set of IPs Configuration
Source: https://www.vdocipher.com/docs/server/playbackauth/ipgeo
This configuration allows access from a set of countries while blocking access from a set of IP addresses, regardless of their origin. Replace 'c1', 'c2', 'c3', 'ip1', 'ip2', 'ip3' with actual values.
```json
{
"allow": ["c1", "c2", "c3"],
"except": ["ip1", "ip2", "ip3"]
}
```
--------------------------------
### Get Video Information using Ruby
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This Ruby code snippet shows how to retrieve video information from the VdoCipher API using the built-in 'net/http' and 'uri' libraries. It constructs an HTTP GET request to the meta endpoint and prints the response body. Remember to replace {{videoID}} with your video's ID.
```ruby
require 'uri'
require 'net/http'
url = URI("https://dev.vdocipher.com/api/meta/{{videoID}}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
```
--------------------------------
### Initialize VdoDownloadManager (Kotlin)
Source: https://www.vdocipher.com/docs/mobile/android/offline
This Kotlin code snippet demonstrates initializing the VdoDownloadManager by providing the application context and the download location. The obtained instance is ready for managing downloads.
```kotlin
vdoDownloadManager = VdoDownloadManager.getInstance(this, downloadLocation)
```
--------------------------------
### Get Video Information using cURL
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This snippet demonstrates how to retrieve video metadata using an HTTP GET request with cURL. It sends a request to the VdoCipher meta API endpoint and expects a JSON response containing video details and poster image URLs. Ensure you replace {{videoID}} with your actual video ID.
```shell
curl -X GET \
https://dev.vdocipher.com/api/meta/{{videoID}} \
-H 'Accept: application/json'
```
--------------------------------
### Get Video Information using Node.js
Source: https://www.vdocipher.com/docs/server/videomanagement/files/posters
This Node.js code snippet shows how to fetch video information from the VdoCipher API using the 'request' library. It makes an HTTP GET request to the meta endpoint and logs the response body, which includes video details and poster image URLs. Replace {{videoID}} with your video's ID.
```javascript
var request = require('request');
var options = {
method: 'GET',
url: 'https://dev.vdocipher.com/api/meta/{{videoID}}',
headers: {Accept: 'application/json'},
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
```
--------------------------------
### Configure Clipping and Player Options
Source: https://www.vdocipher.com/docs/mobile/ios/api-reference
Classes for configuring video clipping markers and general player options during initialization.
```Swift
init(clippingModelConfig: VdoFramework.Clipping? = nil)
init(markerColor: String? = nil, clipStartInSeconds: UInt, clipEndInSeconds: UInt, clipped: Bool)
```
--------------------------------
### GET getPlaybackPropertiesV2
Source: https://www.vdocipher.com/docs/mobile/react-native/getting-started
Retrieves additional playback metrics including total played and covered duration.
```APIDOC
## GET getPlaybackPropertiesV2
### Description
Requests additional playback properties from the player instance.
### Method
GET
### Endpoint
getPlaybackPropertiesV2()
### Response
#### Success Response (200)
- **playbackProperties** (object) - The PlaybackProperty object containing metrics.
- **totalPlayed** (number) - Total played duration in seconds.
- **totalCovered** (number) - Total covered duration in seconds.
#### Response Example
{
"playbackProperties": {
"totalPlayed": 120,
"totalCovered": 300
}
}
```
--------------------------------
### Get Iframe Reference
Source: https://www.vdocipher.com/docs/player/v2/api-reference/accessing-player
Retrieves the iframe element from the DOM to serve as the target for the VdoPlayer instance.
```javascript
const iframe = document.querySelector('iframe');
```
--------------------------------
### Obtain Video Credentials and Upload File using Ruby with VdoCipher API
Source: https://www.vdocipher.com/docs/server/upload/file
This Ruby script illustrates a two-step process for VdoCipher integration: first, obtaining video credentials (videoId) via a PUT request, and second, uploading a file using the obtained upload link and client payload. It utilizes Ruby's built-in 'net/http' and 'json' libraries.
```ruby
require 'uri'
require 'net/http'
require 'json'
# this files shows both step 1 (obtaining credentials) and step 2 (uploading file)
# step 1 (obtaining credentials)
url = URI("https://dev.vdocipher.com/api/videos?title=title&folderId=root")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Apisecret _______'
response = http.request(request)
responseObj = JSON.parse(response.read_body)
# this value should be saved in your DB
puts responseObj['videoId']
# step 2 (uploading file)
url = URI(responseObj['clientPayload']['uploadLink'])
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
clientPayload = responseObj['clientPayload'];
request = Net::HTTP::Post.new(url)
form_data = [
['policy', clientPayload['policy']],
['key', clientPayload['key']],
["x-amz-signature", clientPayload['x-amz-signature']],
["x-amz-algorithm", clientPayload['x-amz-algorithm']],
["x-amz-date", clientPayload['x-amz-date']],
["x-amz-credential", clientPayload['x-amz-credential']],
['success_action_status', '201'],
['success_action_redirect', ""],
['file', File.open('./upload.rb')],
]
request.set_form form_data, 'multipart/form-data'
response = http.request(request)
puts response.read_body
```
--------------------------------
### Launch Fullscreen Video Player in React Native
Source: https://www.vdocipher.com/docs/mobile/react-native/getting-started
Launches a fullscreen video player using the `startVideoScreen` function from the `vdocipher-rn-bridge` package. Requires `otp` and `playbackInfo` for video authentication.
```javascript
import {startVideoScreen} from 'vdocipher-rn-bridge';
startVideoScreen({
embedInfo: {otp: 'some-otp', playbackInfo: 'some-playbackInfo'},
});
```
--------------------------------
### GET /videos/tags/
Source: https://www.vdocipher.com/docs/swagger/schemas-swagger.json
Retrieves a list of tags associated with the user's account. This is useful for features like auto-completion and filtering videos by tags.
```APIDOC
## GET /videos/tags/
### Description
Retrieves a list of tags associated with the user's account. This is useful for features like auto-completion and filtering videos by tags.
### Method
GET
### Endpoint
/videos/tags/
### Parameters
#### Query Parameters
- **q** (string) - Optional - A query parameter for filtering tags.
- **page** (integer) - Optional - Specifies the page number for pagination. The page size will always be 10.
### Response
#### Success Response (200)
- An array of tag objects, where each object contains tag information.
#### Response Example
```json
[
{
"id": "tag_abc123",
"name": "tutorial"
},
{
"id": "tag_def456",
"name": "marketing"
}
]
```
```
--------------------------------
### Initialize Project Configuration
Source: https://www.vdocipher.com/docs/player/v2/examples/basic
The package.json file defines the project dependencies and build tools required for the Vdocipher embed environment. It specifies parcel-bundler as a primary dependency for bundling the application.
```json
{
"name": "vdocipher-embed",
"version": "1.0.0",
"dependencies": {
"parcel-bundler": "^1.6.1"
}
}
```
--------------------------------
### VdoCipher: Setup Playback Delegate
Source: https://www.vdocipher.com/docs/mobile/ios/api-reference
Sets up a delegate to receive callbacks related to video playback events. This is crucial for managing player states and responding to playback changes.
```swift
static func setPlaybackDelegate(delegate: AssetPlaybackDelegate)
```
--------------------------------
### Implement PlaybackEventListener
Source: https://www.vdocipher.com/docs/mobile/android/getting-started
Handles various playback lifecycle events such as loading and loaded states for the VdoPlayer.
```Java
private final VdoPlayer.PlaybackEventListener playbackListener = new VdoPlayer.PlaybackEventListener() {
@Override
public void onLoading(VdoInitParams vdoInitParams) {
}
@Override
public void onLoaded(VdoInitParams vdoInitParams) {
}
};
```
```Kotlin
private val playbackListener = object : VdoPlayer.PlaybackEventListener {
override fun onLoading(vdoInitParams: VdoInitParams) {
}
override fun onLoaded(vdoInitParams: VdoInitParams) {
}
}
```