bluebillywig/vmsrpc 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bluebillywig/vmsrpc

Composer 安装命令:

composer require bluebillywig/vmsrpc

包简介

Composer package allowing to easily connect and communicate with the Blue Billywig VMS API.

README 文档

README

https://support.bluebillywig.com/vms-rpc-php

The vms rpc client makes it possible to connect to the vms more easily. This is achieved by taking away some of the complexities like connecting to the vms. This document provides a technical summary of the vms rpc client for PHP.

Usage

Getting Started

Create a new instance of BlueBillywig\RPC. This can be done by providing the username and password or the shared secret.

A shared secret can be generated by going to https://YourPublication.bbvms.com/ovp/#/publication/api-keys (where YourPublication needs to be substituted with the name of your publication) and clicking CREATE NEW KEY.

Creating instance with username and password

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password';

try {
    $vms = new RPC($host, $user, $password);
} catch (\Exception $e) {
    echo $e->getMessage();
}

Creating instance with shared secret

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$sharedSecret = '123-1234567890abcdefghijklmnopqrstuv';

try {
    $vms = new RPC($host, null, null, $sharedSecret);
} catch (\Exception $e) {
    echo $e->getMessage();
}

Quick start

The following example demonstrates how to search for a couple of mediaclips and immediately print the embed code for each mediaclip.

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$sharedSecret = '123-1234567890abcdefghijklmnopqrstuv';
$arProps = array(
    'query' => 'type:mediaclip AND status:published',
    'limit' => '10',
    'sort' =>'createddate desc'
);

try {
    $vms = new RPC($host, null, null, $sharedSecret);

    $search_result = json_decode($vms->json('search', null, $arProps));

    if($search_result->count > 0) {
        foreach($search_result->items as $oMc) {            
            echo '<script type="text/javascript" src="' . $host . '/p/default/c/'.$oMc->id.'.js"></script>';
        }
    }
} catch (\Exception $e) {
    echo $e->getMessage();
}

Function list

Here you can find the available functions within the RPC, which make it possible to execute API requests. More information concerning API requests can be found here: https://support.bluebillywig.com/vms-api-guide

doAction

Execute API request/action and return the result as an array.

array doAction(string $entity, string $action, array $arProps)

$entity: The relevant api entity that you want to query to obtain the desired result. For example mediaclip, mediacliplist, publication or playout.

$action: The action you want to execute. The actions differ per entity, see the API documentation for details. For example for the mediaclip entity possible actions are get, put or getUsageStats.

$arProps: This array will contain required or optional properties needed for the specific request. For example for the action put of the entity mediaclip you'll need to provide at least the property xml, see the example below.

Here an example to update a mediaclip:

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    //Set the status to draft
    $arProps = array(
        'xml' => '<media-clip id="1234567" status="draft"></media-clip>'
    );
    $r = $vms->doAction('mediaclip', 'put', $arProps);
} catch (\Exception $e) {
    echo $e->getMessage();
}

And an example to add a new mediaclip including a video-file:

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    //Add a new mediaclip, add a file, set the title and set the status.
    $file = getcwd() . "/someVideo.mp4";
    $arProps = array(
        'xml' => '<media-clip title="New mediaclip"  status="draft"></media-clip>', 
        'Filedata' => '@'.$file
    );

    $r = $vms->doAction('mediaclip', 'put', $arProps);
} catch (\Exception $e) {
    echo $e->getMessage();
}

JSON

Execute API request/action and return the result in JSON format. At this moment it's only possible to get results in JSON format for 'get' and 'search' actions on mediaclips, timelines, widgets and zones.

string json(string $entity, int $objectId = null, array $arProps = null)

$entity: The relevant api entity that you want to query to obtain the desired result. For example mediaclip, mediacliplist, publication or playout.

$objectId: (optional) The id of a certain entity, for example the mediaclipid. If $objectId is set the action will become 'get'.

$arProps: (optional) This array contains required or optional properties needed for the specific request.

Below an example to search for a couple of mediaclips.

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $arProps = array(
        'query' => 'type:mediaclip','limit' => '10',
        'sort' =>'createddate desc'
    );
    $r = json_decode($vms->json('search', null, $arProps));
} catch (\Exception $e) {
    echo $e->getMessage();
}

XML

Execute API request/action and return the result in XML format.

string xml(string $entity, int $objectId = null, array $arProps = null)

$entity: The relevant api entity that you want to query to obtain the desired result. For example mediaclip, mediacliplist, publication or playout.

$objectId: (optional) The id of a certain entity, for example the mediaclipid. If $objectId is set the action will become 'get'.

$arProps: (optional) This array contains required or optional properties needed for the specific request. If not set the default action will become 'get'.

Below an example to get global configurations of a publication.

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $r = $vms->xml('publication');
} catch (\Exception $e) {
    echo $e->getMessage();
}

URI

Execute an API request/action and send all properties for the specific request on the query string. This may be useful whether multiple properties with the same key need to be provided, which could be the case for Solr requests.

string uri(string $apiEntityUrl, string $qs = null)

$apiEntityUrl: The relevant api entity that you want to query to obtain the desired result. For example json/mediaclip or json/qstats.

$qs: (optional) The Query String to be send with the request'.

Below an example to get the mainconfig.xml, which contains configuration of your publication such as asset-paths.

require __DIR__ . '/vendor/autoload.php';

use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $apiEntityUrl = "";
    $qs = 'mainconfig.xml';

    $r = $vms->uri($apiEntityUrl, $qs);
} catch (\Exception $e) {
    echo $e->getMessage();
}

Unit Testing

To run the PHP unit tests, clone this repository, run composer install and copy tests/config.example.yaml to tests/config.yaml. Update tests/config.yml with the settings that apply to your publication.

Run the tests with on of the following commands.

./vendor/bin/phpunit
composer test

bluebillywig/vmsrpc 适用场景与选型建议

bluebillywig/vmsrpc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 49.89k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bluebillywig/vmsrpc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bluebillywig/vmsrpc 我们能提供哪些服务?
定制开发 / 二次开发

基于 bluebillywig/vmsrpc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 49.89k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-15