Coder Social home page Coder Social logo

zencoder-java's Introduction

zencoder-java

Java library for interacting with the Zencoder API.

Getting Started

Add the library as a dependancy to your project.

If you're using Maven, add this to your pom.xml file:

    <dependency>
          <groupId>com.brightcove.zencoder.api</groupId>
          <artifactId>zencoder-java</artifactId>
          <version>2.0.19</version>
    </dependency>

Import the client and related classes:

import com.brightcove.zencoder.client.ZencoderClient;
import com.brightcove.zencoder.client.ZencoderClientException;
import com.brightcove.zencoder.client.model.*
import com.brightcove.zencoder.client.request.*
import com.brightcove.zencoder.client.response.*;

Instantiate a new client with your API key:

ZencoderClient client = new ZencoderClient("INSERT_API_KEY_HERE");

Usage

Create a new job:

ZencoderCreateJobRequest job = new ZencoderCreateJobRequest();
job.setInput("s3://zencodertesting/test.mov");
List<ZencoderOutput> outputs = new ArrayList<ZencoderOutput>();

ZencoderOutput output1 = new ZencoderOutput();
output1.setFormat(ContainerFormat.MP4);
outputs.add(output1);

ZencoderOutput output2 = new ZencoderOutput();
output2.setFormat(ContainerFormat.WEBM);
outputs.add(output2);

job.setOutputs(outputs);
ZencoderCreateJobResponse response = client.createZencoderJob(job);

Query an existing job:

String jobId = response.getId();
ZencoderJobDetail details = client.getZencoderJob(jobId);
String inputId = details.getInputMediaFile().getId();
String outputId1 = response.getOutputs().get(0).getId();
String outputId2 = response.getOutputs().get(1).getId();
        
ZencoderInputOutputProgress inputProgress = client.getInputProgress(inputId);
ZencoderInputOutputProgress outputProgress1 = client.getOutputProgress(outputId1);
ZencoderInputOutputProgress outputProgress2 = client.getOutputProgress(outputId2);

Cancel and resubmit an existing job:

client.cancelJob(jobId);
client.resubmitJob(jobId);

Copyright

See LICENSE.txt for details.

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.