承接 opencoconut/coconut 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

opencoconut/coconut

最新稳定版本:3.0.3

Composer 安装命令:

composer require opencoconut/coconut

包简介

Coconut is a Cloud Video Encoding Service built for developers

README 文档

README

The Coconut PHP library provides access to the Coconut API for encoding videos, packaging media files into HLS and MPEG-Dash, generating thumbnails and GIF animation.

This library is only compatible with the Coconut API v2.

Documentation

See the full documentation.

Installation

To install the Coconut PHP library, you need composer first:

curl -sS https://getcomposer.org/installer | php

Edit composer.json:

{
    "require": {
        "opencoconut/coconut": "3.*"
    }
}

Install the depencies by executing composer:

php composer.phar install

Usage

The library needs you to set your API key which can be found in your dashboard. Webhook URL and storage settings are optional but are very convenient because you set them only once.

<?php

require_once('vendor/autoload.php');

$coconut = new Coconut\Client('k-api-key');

$coconut->notification = [
  'type' => 'http',
  'url' => 'https://yoursite/api/coconut/webhook'
];

$coconut->storage = [
  'service' => 's3',
  'bucket' => 'my-bucket',
  'region' => 'us-east-1',
  'credentials' => [
    'access_key_id' => 'access-key',
    'secret_access_key' => 'secret-key'
  ]
];

?>

Creating a job

<?php

try {
  $job = $coconut->job->create([
    'input' => [ 'url' => 'https://mysite/path/file.mp4' ],
    'outputs' => [
      'jpg:300x' => [ 'path' => '/image.jpg' ],
      'mp4:1080p' => [ 'path' => '/1080p.mp4' ],
      'httpstream' => [
        'hls' => [ 'path' => 'hls/' ]
      ]
    ]
  ]);

  print_r($job);

} cacth(Exception $e) {
  echo $e->getMessage();
}

?>

Getting information about a job

$job = $coconut->job->retrieve('OolQXaiU86NFki');

Retrieving metadata

$metadata = $coconut->metadata->retrieve('OolQXaiU86NFki');

Released under the MIT license.

统计信息

  • 总下载量: 450.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-25