Skip to content

Commit 9949d01

Browse files
Nathan Sassrtyler
Nathan Sass
andauthored
Armadillo Blogpost (scribd#104)
* initial blogpost infos * armadillo image * Update the Armadillo post and prepare for publication * Update and rename 2021-06-01-android-audio-player-tutorial-with-armadillo.md to 2021-06-22-android-audio-player-tutorial-with-armadillo.md * updated pub date and added links * added links for github * update armadillo logo * Rename 2021-06-28-android-audio-player-tutorial-with-armadillo.md to 2021-09-27-android-audio-player-tutorial-with-armadillo.md * Rename 2021-09-27-android-audio-player-tutorial-with-armadillo.md to 2021-09-29-android-audio-player-tutorial-with-armadillo.md update date * yaml gonna yaml Co-authored-by: R. Tyler Croy <[email protected]>
1 parent 36ff58b commit 9949d01

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

_data/authors.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ antoniam:
152152
about: |
153153
Antonia is a data scientist on the Applied Research team building machine learning models to understand and connect our content.
154154
155+
nathans:
156+
name: Nathan Sass
157+
github: NathanSass
158+
about: |
159+
Nathan is a software engineer on the Android platform team.
160+
155161
rafaelp:
156162
name: Rafael Lacerda
157163
github: lacerda
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
layout: post
3+
title: "Armadillo makes audio players in Android easy"
4+
tags:
5+
- android
6+
- kotlin
7+
- armadillo
8+
- featured
9+
author: nathans
10+
team: Android
11+
---
12+
13+
Armadillo is the fully featured audio player library Scribd uses to play and
14+
download all of its audiobooks and podcasts, which is [now open
15+
source](https://github.com/scribd/armadillo). It specializes in playing HLS
16+
or MP3 content that is broken down into chapters or tracks. It leverages
17+
[Google’s Exoplayer](https://github.com/google/ExoPlayer/) library for its audio engine. Exoplayer wraps a variety of
18+
low level audio and video apis but has few opinions of its own for actually
19+
using audio in an Android app.
20+
21+
![Armadillo Image](https://raw.githubusercontent.com/scribd/armadillo/main/armadillo.webp)
22+
23+
The leap required from Exoplayer to audio player
24+
is enormous both in terms of the amount of code needed as well as the amount of
25+
domain knowledge required about complex audio related subjects. Armadillo
26+
provides a turn-key solution for powering an audio player and providing the
27+
information to update a UI.
28+
29+
- **Easy-to-use** because it outputs state updates with everything needed for a UI or analytics. Works in the background state.
30+
- **Effective** because it uses Google’s Exoplayer as the playback engine.
31+
- **Ready-to-go** out of the box usage for a developer looking to use an audio player.
32+
- **Robust** because it contains numerous configuration options for supporting most any requirement and includes a number of other android apis
33+
required for a high quality audio player.
34+
35+
## What does it include?
36+
37+
- Support for HLS and MP3 audio
38+
- Exoplayer for downloading and playback
39+
- [MediaBrowserService](https://developer.android.com/reference/android/service/media/MediaBrowserService) so the app can be played in the background, browsed by other apps, and integrated with Android Auto.
40+
- [MediaSession](https://developer.android.com/reference/android/media/session/MediaSession) to support commands from media controllers, ex. a bluetooth headset.
41+
42+
## Getting Started:
43+
44+
The library is hosted with Github packages so you will need to add the Github registry with authentication to your build.gradle file. See the official docs on authenticating [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages). But you will need to:
45+
46+
1. Generate a [personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) from your Github account.
47+
1. Add the Github package registry with authentication to your `build.gradle` file.
48+
49+
```kotlin
50+
maven {
51+
name = "GitHubPackages"
52+
url = uri("https://maven.pkg.github.com/scribd/armadillo-and")
53+
credentials {
54+
username = "github_username"
55+
password = "github_access_token"
56+
}
57+
}
58+
```
59+
60+
It is as easy as adding this code snippet to your Activity / Fragment to play your first piece of content.
61+
62+
```kotlin
63+
// construct your media
64+
val media = AudioPlayable(
65+
id = 0,
66+
title = "Google Hosted Mp3",
67+
request = AudioPlayable.MediaRequest.createHttpUri("https://storage.googleapis.com/exoplayer-test-media-0/play.mp3"),
68+
chapters = emptyList()
69+
)
70+
71+
// initialize the player
72+
val armadilloPlayer = ArmadilloPlayerFactory.init()
73+
74+
// begin playback
75+
armadilloPlayer.beginPlayback(media)
76+
77+
// listen for state updates
78+
armadilloPlayer.armadilloStateObservable.subscribe {
79+
80+
// update your UI here
81+
82+
}
83+
```
84+
85+
That’s all you need to get started!
86+
87+
## Next Steps:
88+
89+
For a more complex example, please see the [TestApp](https://github.com/scribd/armadillo/tree/main/TestApp) included in the library. If
90+
you have any problems, don’t be afraid to open up an issue [on
91+
GitHub](https://github.com/scribd/armadillo).
92+

0 commit comments

Comments
 (0)