Giter VIP home page Giter VIP logo

aliyun-vod's Introduction

Aliyun Vod for PHP


因为项目驱动,目前只自定义了几个简单的方法,用于视频查询鉴权和视频上传系列接口,比较其他很多功能接口,我个人觉得直接去控制台更好管理。如果你执意要用,那我只能说你很棒棒哦,需要vod其他的api方法调用,可以参考官方SDK文档使用本包进行调用,本包包含官方所有接口文件,composer已自动载入官方SDK,可以参考。Service/下几个文件。

同胞兄弟

Installing

$ composer require shaozeming/aliyun-vod -v

configuration

拷贝项目下src/config.php到你项目中,进行配置其中vod。

配置示例代码:

return [

    /*点播配置*/
    'vod' => [
        'AccessKeyID' => '******密码不能给你看******',
        'AccessKeySecret' => '******密码不能给你看******',
        'regionId' => 'cn-shanghai',   // 点播服务接入区域
        'timeout' => '3600',  // 如果是获取签名有效时间为多少
        'type' => 'access',  //类型:access|sts 如果是sts 实例化对象时候需要传入$securityToken
        'acceptFormat' => 'JSON',  //返回数据格式
    ],
];

Example

  • 拷贝项目下src/config.php到你项目中,进行配置。
use ShaoZeMing\AliVod\Services\ReadService;
use ShaoZeMing\AliVod\Services\UploadService;


 
 
             $config = include 'you_path/config.php';

             $instance = new UploadService($config);


//            $title ='title';
//            $filename= 'filename.mp4';
//            $desc = "这是一个测试视频";
//            $coverUrl='http://www.pptbz.com/pptpic/UploadFiles_6909/201203/2012031220134655.jpg';
//            $tags=['标签1','标签2'];
//            $result =  $instance->createUploadVideo($title,$filename,$desc,$coverUrl, $tags);  //获取视频上传地址和凭证
//            $result =  $instance->refreshUploadVideo($videoId);  //刷新视频上传凭证
//            $result = $instance->uploadMediaByURL($url,$title);  //url 拉去视屏上传
            
            
              $read = new ReadService($config);
              $result =  $read->getPlayAuth('4db8b50cbee04154b9557a4812a27584'); // 获取播放权限参数
//            $result =  $read->getPlayInfo('4db8b50cbee04154b9557a4812a27584'); // 获取播放信息
            
            print_r($result);
            return $result;
       

使用原生官方sdk接口示例

  • 目前只重写了几个接口方便使用,官方这个很多接口没有写,你们要使用可以直接使用原生方法。
use ShaoZeMing\AliVod\SDK\GetPlayInfoRequest;

    /**
     * 获取视频播放详细信息
     * User: ZeMing Shao
     * Email: [email protected]
     * @param $videoId
     * @param float|int $timeout
     * @return mixed|\ShaoZeMing\Aliyun\Core\SimpleXMLElement
     * @throws \ShaoZeMing\Aliyun\Core\Exception\ClientException
     * @throws \ShaoZeMing\Aliyun\Core\Exception\ServerException
     */
    function getPlayInfo($videoId, $timeout = 3600 * 24)
    {
        $request = new GetPlayInfoRequest();
        $request->setVideoId($videoId);
        $request->setAuthTimeout($timeout);
        $request->setAcceptFormat('JSON');
        $playInfo = $this->client->getAcsResponse($request);
        return $playInfo;
    }

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.