审查视图

vendor/qiniu/php-sdk/examples/pulpvideo.php 1.0 KB
郭盛 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<?php

require_once __DIR__ . '/../autoload.php';

use Qiniu\Auth;
use Qiniu\Http\Client;

$accessKey = getenv('QINIU_ACCESS_KEY');
$secretKey = getenv('QINIU_SECRET_KEY');
$auth = new Auth($accessKey, $secretKey);
$config = new \Qiniu\Config();
$argusManager = new \Qiniu\Storage\ArgusManager($auth, $config);

$reqBody = array();
$reqBody['uri'] = "xxxx";

$ops = array();
$ops = array(
    array(
        'op' => 'pulp',
        'params' => array(
            'labels' => array(
                array(
                    'label' => "1",
                    'select' => 1,
                    'score' => 2,
                ),
            )
        )
    ),
);

$params = array();
$params = array(
    'async' => false,
    'vframe' => array(
        'mode' => 1,
        'interval' => 8,
    )
);

$req = array();
$req['data'] = $reqBody;
$req['ops'] = $ops;
$req['params'] = $params;
$body = json_encode($req);

$vid = "xxxx";
list($ret, $err) = $argusManager->pulpVideo($body, $vid);

if ($err !== null) {
    var_dump($err);
} else {
    var_dump($ret);
}