Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gumlet Video Player - Sample Android App

This repository contains the sample Android application demonstrating integration and usage of the Gumlet Video Player SDK (v1.1.0) for Android, built on top of AndroidX Media3 (ExoPlayer).

Features & Capabilities

  • Adaptive Streaming: Native support for HLS (.m3u8), DASH (.mpd), and progressive MP4 streaming.
  • DRM Support: Seamless integration with Widevine DRM for both online and offline protected content.
  • Offline Playback: Download videos (with or without DRM) using GumletDownloadManager for playback without internet.
  • Background Downloads: Foreground service with progress notifications — downloads survive app restarts.
  • Simple Integration: Setup and start playback with just a few lines of code.
  • Customizable Controls: Toggle built-in playback controls or build your own UI on top.
  • Lifecycle Aware: Forwarding methods to prevent memory leaks and handle system events cleanly.

Requirements

  • Minimum SDK: API 24 (Android 7.0)
  • Target / Compile SDK: API 36 (Android 15/16)
  • Kotlin: 2.0+

Installation & Setup

1. Configure Repositories (settings.gradle.kts)

Add the Gumlet Maven Repository:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://github.com/gumlet/maven-releases/raw/main") }
    }
}

2. Add SDK Dependency (app/build.gradle.kts)

dependencies {
    // Gumlet Video Player SDK v1.1.0
    implementation("com.gumlet.video:player:1.1.0")
}

3. Update AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
    <!-- Android 13+ for download progress notifications -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

    <application ...>
        <!-- Required for Android 12+ data auditing -->
        <attribution android:tag="gumlet_player" android:label="@string/gumlet_player_attribution_label" />
    </application>
</manifest>

Add to res/values/strings.xml:

<string name="gumlet_player_attribution_label">Video Playback</string>

Code Examples

Online Playback

Add GumletPlayerView to your layout:

<com.gumlet.video.player.GumletPlayerView
    android:id="@+id/gumlet_player_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Initialize player and load stream:

val playerView = findViewById<GumletPlayerView>(R.id.gumlet_player_view)

val params = GumletInitParams.Builder()
    .setVideoUrl("https://video.gumlet.io/example/main.m3u8")
    .setAutoPlay(true)
    .setControlsEnabled(true)
    .setDrmLicenseUrl("https://widevine.gumlet.com/licence/...") // Optional Widevine DRM
    .build()

playerView.load(params)

Offline Downloads & Playback

1. Initialize Download Manager

Call once during app startup:

GumletDownloadManager.initialize(context)

2. Trigger Download

GumletDownloadManager.downloadVideo(
    context       = this,
    videoId       = "my_unique_video_id",
    videoUrl      = "https://video.gumlet.io/example/main.m3u8",
    drmLicenseUrl = "https://widevine.gumlet.com/licence/..." // Optional DRM
)

3. Play Offline Video

val state = GumletDownloadManager.getDownloadState(context, "my_unique_video_id")
val isOfflineReady = state is GumletDownloadState.Completed

val params = GumletInitParams.Builder()
    .setVideoId("my_unique_video_id")
    .setVideoUrl("https://video.gumlet.io/example/main.m3u8")
    .setEnableOfflinePlayback(isOfflineReady)
    .setAutoPlay(true)
    .build()

playerView.load(params)

Lifecycle Management

override fun onPause()   { super.onPause();   playerView.onPause() }
override fun onResume()  { super.onResume();  playerView.onResume() }
override fun onDestroy() { super.onDestroy(); playerView.onDestroy() }

API Reference

GumletInitParams Reference

Builder Method Type Default Description
setVideoUrl(url) String required Stream URL (HLS, DASH, MP4)
setVideoId(id) String? null Unique ID for offline download lookup
setDrmLicenseUrl(url) String? null Widevine license server URL
setAutoPlay(enabled) Boolean true Start playing immediately
setControlsEnabled(enabled) Boolean true Show built-in playback controls
setEnableOfflinePlayback(enabled) Boolean false Use local cache for playback

GumletDownloadState Reference

State Description
NotDownloaded No download exists for this video
Queued Waiting to start
Downloading(percentDownloaded) In progress — percentage 0–100
Completed Fully downloaded, ready for offline play
Failed(reason) Download failed — reason contains error message
Stopped Paused by user
Removing Being deleted

Project Structure

sample-android-app/
├── app/
│   ├── src/
│   │   └── main/
│   │       ├── java/com/gumlet/myapplication/
│   │       │   ├── MainActivity.kt        # Input UI & feature triggers
│   │       │   ├── PlayerActivity.kt      # Video playback container
│   │       │   ├── DownloadsActivity.kt   # Offline downloads manager
│   │       │   └── VideoPlayerActivity.kt # Legacy reference activity
│   │       ├── res/                       # Layouts, shapes, themes, strings
│   │       └── AndroidManifest.xml
│   └── build.gradle.kts
├── settings.gradle.kts
└── README.md

License

Copyright © 2026 Gumlet. All rights reserved.

About

Sample android app using Gumlet sdk to play videos

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages