Documentation

Ziggeo's Android SDK is the best video recording/playback SDK out there.

It is managed publicly on GitHub here.

Fork me on GitHub
  • We also have an iOS Objective C SDK, see here.
  • We also have an iOS Swift SDK, see here.
  • For a list of features, see here.

What's new in 0.5+:

  • Added part of ziggeo's api support for video and stream services.
  • Access to api method will be through its own service, so now, instead of ziggeo.index(...); you will have to call ziggeo.videos().index(...); and ziggeo.streams().index(...); etc.
  • Removed subscribing on custom events. Now for every action you will have to provide callback.
  • Added ProgressCallback to handle file uploading progress. Just use it instead of simple Callback.

How to include the sdk:

Put ziggeo-sdk-v*.aar in libs folder for your project. In Android Studio choose File->New->New Module and select Import .JAR/.AAR Package. Add the following dependencies to your build.gradle file

        compile(name: 'ziggeo-sdk-v0.62.0', ext: 'aar')
        compile 'com.squareup.okhttp3:okhttp:3.4.1'
        compile 'com.danikula:videocache:2.4.0'
        compile "com.android.support:support-v4:24.2.0"
        compile "com.android.support:support-v13:24.2.0"

Fullscreen video recorder:

Ziggeo ziggeo = new Ziggeo(APP_TOKEN, context);
long maxVideoDuration = 1000 * 60 * 5; //for ex. 5 mins.

/**
  * Use this for launch standalone activity with video recorder and player.
  *
  * @param context             - context
  * @param maxDurationInMillis - allowed max video duration in milliseconds.
  * @param callback            - callback to receive video recording result or handle progress
  */
ziggeo.createVideo(Context context, long maxDurationInMillis, Callback callback);

Embedded video recorder:

Ziggeo ziggeo = new Ziggeo(APP_TOKEN, context);
long maxVideoDutaion = 1000 * 60 * 5; //for ex. 5 mins.

/**
  * Use this for launch embedded recorder
  *
  * @param manager             - {@link FragmentManager}
  * @param contentId           - Identifier of the container this fragment is to be placed in.
  * @param maxDurationInMillis - allowed max video duration in milliseconds.
  * @param callback            - callback to receive video recording result or handle progress
  */
ziggeo.attachRecorder(FragmentManager manager, int contentId, long maxDurationInMillis, Callback callback);
Add extra args
ziggeo.setExtraArgsForCreateVideo(HashMap<String, String> extraArgs);
By default recorded video will send immideately after it was recorded.
To prevent this use
ziggeo.setSendImmediately(false);
You also can disable camera switching
/**
     * Use this for launch embedded recorder
     *
     * @param manager                - {@link FragmentManager}
     * @param contentId              - Identifier of the container this fragment is to be placed in.
     * @param maxDurationInMillis    - allowed max video duration in milliseconds.
     * @param disableCameraSwitching - removes ability to switch cameras.
     *                               The default camera is {@link Camera.CameraInfo.CAMERA_FACING_BACK}
     */
    public void attachRecorder(FragmentManager manager, int contentId, long maxDurationInMillis,
                               boolean disableCameraSwitching)
/**
     * Use this for launch standalone activity with video recorder and player.
     *
     * @param context                - context
     * @param maxDurationInMillis    - allowed max video duration in milliseconds.
     * @param disableCameraSwitching - removes ability to switch cameras.
     *                               The default camera is {@link Camera.CameraInfo.CAMERA_FACING_BACK}
     */
    public void createVideo(Context context, long maxDurationInMillis, boolean disableCameraSwitching)
Or select default camera and disable switching.
/**
     * Use this for launch standalone activity with video recorder and player.
     *
     * @param context             - context
     * @param maxDurationInMillis - allowed max video duration in milliseconds.
     * @param preferredCameraId   - allow the app use only selected camera if exists.
     */
    public void createVideo(Context context, long maxDurationInMillis, int preferredCameraId)
/**
     * Use this for launch embedded recorder
     *
     * @param manager             - {@link FragmentManager}
     * @param contentId           - Identifier of the container this fragment is to be placed in.
     * @param maxDurationInMillis - allowed max video duration in milliseconds.
     * @param preferredCameraId          - allow the app use only selected camera if exists.
     */
    public void attachRecorder(FragmentManager manager, int contentId, long maxDurationInMillis,
                               int preferredCameraId)
And select video quality using
com.ziggeo.androidsdk.recording.CameraHelper.Quality

Video player:

Ziggeo ziggeo = new Ziggeo(APP_TOKEN, context);
Uri path = ...; // path to file or stream url
// or
String token = ...; // video token

/**
  * Use this for launch embedded player from path
  *
  * @param manager   - {@link FragmentManager}
  * @param contentId - Identifier of the container this fragment is to be placed in.
  * @param path      - {@link Uri} path to file.
  */
ziggeo.attachPlayer(FragmentManager manager, int contentId, Uri path);
 /**
  * Use this for launch embedded player from stream.
  * Can be also used with extra args.
  *
  * @param manager   - {@link FragmentManager}
  * @param contentId - Identifier of the container this fragment is to be placed in.
  * @param token     - video token.
  */
ziggeo.attachPlayer(FragmentManager manager, int contentId, String videoToken);
Add extra args
ziggeo.setExtraArgsForPlayVideo(...);

Ziggeo API access

Videos api
/**
     * Delete a single video by token or key.
     *
     * @param keyOrToken - video token or key.
     *                   If you're using key make sure to add "_" prefix.
     * @param callback   - callback to receive action result
     */
ziggeo.videos().delete(String keyOrToken, Callback callback);

/**
     * Query an array of videos (will return at most 50 videos by default). Newest videos come first.
     *
     * @param argsMap  - limit: Limit the number of returned videos. Can be set up to 100.
     *                 - skip: Skip the first [n] entries.
     *                 - reverse: Reverse the order in which videos are returned.
     *                 - states: Filter videos by state
     *                 - tags: Filter the search result to certain tags
     * @param callback - - callback to receive action result
     */
ziggeo.videos().index(HashMap<String, String> argsMap, Callback callback);

/**
     * Get a single video by token or key.
     *
     * @param keyOrToken - video token or key.
     *                   If you're using key make sure to add "_" prefix.
     * @param callback   - callback to receive action result
     */
ziggeo.videos().get(String keyOrToken, Callback callback);

/**
  * Download the video data file.
  *
  * @param keyOrToken - video token or key.
  *                   If you're using key make sure to add "_" prefix.
  * @param callback   - callback to receive action result
  */
  ziggeo.videos().downloadVideo(@NonNull String keyOrToken, @NonNull Callback callback);

 /**
  * Download the video data file.
  *
  * @param keyOrToken - video token or key.
  *                   If you're using key make sure to add "_" prefix.
  * @param callback   - callback to receive action result
  */
   ziggeo.videos().downloadImage(@NonNull String keyOrToken, @NonNull Callback callback);

/**
  * Update single video by token or key.
  *
  * @param keyOrToken - video token or key.
  *                   If you're using key make sure to add "_" prefix.
  * @param argsMap    - min_duration: Minimal duration of video
  *                   - max_duration: Maximal duration of video
  *                   - tags: Video Tags
  *                   - key: Unique (optional) name of video
  *                   - volatile: Automatically removed this video if it remains empty
  *                   - expiration_days: After how many days will this video be deleted
  * @param callback   - callback to receive action result
  */
ziggeo.videos().update(String keyOrToken, HashMap<String, String> argsMap, Callback callback);

/**
  * Create a new video.
  *
  * @param argsMap  - file: Video file to be uploaded
  *                 - min_duration: Minimal duration of video
  *                 - max_duration: Maximal duration of video
  *                 - tags: Video Tags
  *                 - key: Unique (optional) name of video
  *                 - volatile: Automatically removed this video if it remains empty
  * @param callback - callback to receive action result
  */
ziggeo.videos().create(HashMap<String, String> argsMap, Callback callback);
Streams api
/**
     * Create a new stream
     *
     * @param videoTokenOrKey - video for which stream will be created
     * @param callback        - callback to receive action result
     */
ziggeo.streams().create(String videoTokenOrKey, Callback callback);

/**
     * Create a new stream
     *
     * @param videoTokenOrKey - video for which stream will be created
     * @param videoFile       - Video file to be uploaded
     * @param callback        - callback to receive action result
     */
 ziggeo.streams().create(@NonNull String videoTokenOrKey, @NonNull File videoFile, @Nullable HashMap<String, String> argsMap, @NonNull Callback callback);

/**
     * Attaches an image to a new stream
     *
     * @param videoTokenOrKey  - video token
     * @param streamTokenOrKey - stream to attach a file
     * @param imageFile        - file to attach
     * @param callback         - callback to receive action result or handler progress
     */
ziggeo.streams().attachImage(videoTokenOrKey, String streamTokenOrKey, File imageFile, Callback callback);

/**
     * Attaches a video to a new stream
     *
     * @param videoTokenOrKey  - video token
     * @param streamTokenOrKey - stream to attach a file
     * @param videoFile        - file to attach
     * @param callback         - callback to receive action result or handle progress
     */
ziggeo.streams().attachVideo(String videoTokenOrKey, String streamTokenOrKey, File videoFile, Callback callback);

/**
  * Closes and submits the stream
  *
  * @param videoTokenOrKey  - video token
  * @param streamTokenOrKey - stream to attach a file
  * @param callback         - callback to receive action result
  */
ziggeo.streams().bind(String videoTokenOrKey, String streamTokenOrKey, Callback callback);

 /**
  * Download the video data associated with the stream
  *
  * @param videoTokenOrKey  - video token
  * @param streamTokenOrKey - stream to attach a file
  * @param callback         - callback to receive action result
  */
 ziggeo.streams().downloadVideo(@NonNull String videoTokenOrKey, @NonNull String streamTokenOrKey, @NonNull Callback callback);

 /**
  * Download the image data associated with the stream
  *
  * @param videoTokenOrKey  - video token
  * @param streamTokenOrKey - stream to attach a file
  * @param callback         - callback to receive action result
  */
 ziggeo.streams().downloadImage(@NonNull String videoTokenOrKey, @NonNull String streamTokenOrKey, @NonNull Callback callback);


/**
     * Get a single stream
     *
     * @param videoTokenOrKey  - video token
     * @param streamTokenOrKey - stream to attach a file
     * @param callback         - callback to receive action result
     */
ziggeo.streams().get(String videoTokenOrKey, String streamTokenOrKey, Callback callback);

/**
     * Delete the stream
     *
     * @param videoTokenOrKey  - video token
     * @param streamTokenOrKey - stream to attach a file
     * @param callback         - callback to receive action result
     */
ziggeo.streams().delete(String videoTokenOrKey, String streamTokenOrKey, Callback callback);
Requests cancellation

Every service call returns Call object, you can cancel request execution, by calling cancel method. For example

Call call = mVideoService.create(...);
call.cancel();

Also you can cancel requests for embedded recorder mZiggeo.cancel()