pbmengine / pbm-video-sdk
此包是用于PBM视频API的PHP Rest Client SDK
1.0.2
2022-09-20 09:07 UTC
Requires
- php: ^8.0.2
- guzzlehttp/guzzle: ^7.4
- illuminate/config: ^9.0
- illuminate/contracts: ^9.0
- illuminate/http: ^9.0
- illuminate/support: ^9.0
- spatie/data-transfer-object: ^3.7
Requires (Dev)
- mockery/mockery: ^1.4.0
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-10-01 18:48:51 UTC
README
PHP SDK提供了一个方便的方式来使用PBM视频API。
安装
您可以通过composer安装此包
composer require pbmengine/pbm-video-sdk
使用
先决条件
您需要API密钥才能使用此包!
创建项目
您必须创建一个项目才能使用API。实际上,您可能只需要为每个应用程序创建一个项目。因此,将project_id存储在您的配置文件中。
$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>);
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全
如果您发现任何安全相关的问题,请通过电子邮件systems@personal-business-machine.com联系,而不是使用问题跟踪器。
许可
MIT许可证(MIT)。有关更多信息,请参阅许可文件。