PHP code example of pbmengine / pbm-video-sdk

1. Go to this page and download the library: Download pbmengine/pbm-video-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pbmengine / pbm-video-sdk example snippets


$project = video()->createProject(<project name>, <identifier optional>, <description optional);
// your project id
$project->data()->id
// your project access key
$project->data()->access_key
// your project secret key
$project->data()->secret_key
// store these values in config/pbm-video.php

// the data to create a template must contain
// please see api documentation for more properties
// movie name and movie project id must be known from isw
$data = [
    'name' => 'super duper video',
    'movie_name' => 'the well known movie name',
    'movie_project_id' => 'the well known movie project id',
    'protection' => true|false // if protected the video is not publicly accessible
];

$template = video()->createTemplate(<your project id>, array $data);

$movie = video()->iswProject(<movie project id>);
// response is something like this
// important here is the variables -> collection field -> name
[
  "data" => array:4 [
    "id" => "12e2045f-6257-48c7-bdaa-3a975bf74598"
    "created_at" => "2019-11-21T12:42:01+00:00"
    "name" => "video_test_api"
    "dynamic_movies" => array:1 [
      0 => array:9 [
        "seconds" => 10
        "variable_length" => false
        "width" => 1920
        "height" => 1080
        "codec" => "H264/AAC"
        "created_at" => "2019-11-21T12:51:03+00:00"
        "updated_at" => "2020-02-04T16:08:15+00:00"
        "name" => "intro_clip"
        "variables" => array:1 [
          "collection" => array:3 [
            0 => array:4 [
              "num_frames" => 250
              "default_value" => "hintergrund.jpg"
              "name" => "hintergrund"
              "type" => "image"
            ]
            1 => array:4 [
              "num_frames" => 250
              "default_value" => "Mustervorname"
              "name" => "vorname"
              "type" => "text"
            ]
            2 => array:4 [
              "num_frames" => 250
              "default_value" => "Musternachname"
              "name" => "nachname"
              "type" => "text"
            ]
          ]
        ]
      ]
    ]
  ]
]

// data should be
$data = [
    'params' => [
        'key1' => 'value',
        'key2' => 'value',
        'key3' => 'value',
    ]
];
$video = video()->createVideo(<projectId>, <templateId>, <name>, <data>)

$status = video()->videoStatus(<video id>, <project id>);