-
Notifications
You must be signed in to change notification settings - Fork 23
Armadillo Blogpost #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Armadillo Blogpost #104
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
28685c9
initial blogpost infos
2872dee
armadillo image
78dcbb5
Update the Armadillo post and prepare for publication
rtyler 0f8cb62
Update and rename 2021-06-01-android-audio-player-tutorial-with-armad…
NathanSass 4c24225
updated pub date and added links
d41ec7d
added links for github
68c052e
update armadillo logo
ce0759e
Rename 2021-06-28-android-audio-player-tutorial-with-armadillo.md to …
bc43eda
Merge branch 'main' into nathan/armadillo
75c6ba0
Rename 2021-09-27-android-audio-player-tutorial-with-armadillo.md to …
f43536f
yaml gonna yaml
rtyler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,3 +137,7 @@ gregr: | |
name: Greg Reznik | ||
github: imfromthebay | ||
|
||
|
||
nathans: | ||
name: Nathan Sass | ||
github: NathanSass |
93 changes: 93 additions & 0 deletions
93
_posts/2021-06-28-android-audio-player-tutorial-with-armadillo.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
layout: post | ||
title: "Armadillo makes audio players in Android easy" | ||
tags: | ||
- android | ||
- kotlin | ||
- armadillo | ||
- featured | ||
author: nathans | ||
team: Android | ||
--- | ||
|
||
Armadillo is the fully featured audio player library Scribd uses to play and | ||
download all of its audiobooks and podcasts, which is [now open | ||
source](https://github.com/scribd/armadillo). It specializes in playing HLS | ||
or MP3 content that is broken down into chapters or tracks. It leverages | ||
[Google’s Exoplayer](https://github.com/google/ExoPlayer/) library for its audio engine. Exoplayer wraps a variety of | ||
low level audio and video apis but has few opinions of its own for actually | ||
using audio in an Android app. | ||
|
||
 | ||
<sup>Icon made by [Freepik](https://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com/) <sub> | ||
|
||
The leap required from Exoplayer to audio player | ||
is enormous both in terms of the amount of code needed as well as the amount of | ||
domain knowledge required about complex audio related subjects. Armadillo | ||
provides a turn-key solution for powering an audio player and providing the | ||
information to update a UI. | ||
|
||
- **Easy-to-use** because it outputs state updates with everything needed for a UI or analytics. Works in the background state. | ||
- **Effective** because it uses Google’s Exoplayer as the playback engine. | ||
- **Ready-to-go** out of the box usage for a developer looking to use an audio player. | ||
- **Robust** because it contains numerous configuration options for supporting most any requirement and includes a number of other android apis | ||
required for a high quality audio player. | ||
|
||
## What does it include? | ||
|
||
- Support for HLS and MP3 audio | ||
- Exoplayer for downloading and playback | ||
- [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. | ||
- [MediaSession](https://developer.android.com/reference/android/media/session/MediaSession) to support commands from media controllers, ex. a bluetooth headset. | ||
|
||
## Getting Started: | ||
|
||
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: | ||
|
||
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. | ||
1. Add the Github package registry with authentication to your `build.gradle` file. | ||
|
||
```kotlin | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/scribd/armadillo-and") | ||
credentials { | ||
username = "github_username" | ||
password = "github_access_token" | ||
} | ||
} | ||
``` | ||
|
||
It is as easy as adding this code snippet to your Activity / Fragment to play your first piece of content. | ||
|
||
```kotlin | ||
// construct your media | ||
val media = AudioPlayable( | ||
id = 0, | ||
title = "Google Hosted Mp3", | ||
request = AudioPlayable.MediaRequest.createHttpUri("https://storage.googleapis.com/exoplayer-test-media-0/play.mp3"), | ||
chapters = emptyList() | ||
) | ||
|
||
// initialize the player | ||
val armadilloPlayer = ArmadilloPlayerFactory.init() | ||
|
||
// begin playback | ||
armadilloPlayer.beginPlayback(media) | ||
|
||
// listen for state updates | ||
armadilloPlayer.armadilloStateObservable.subscribe { | ||
|
||
// update your UI here | ||
|
||
} | ||
``` | ||
|
||
That’s all you need to get started! | ||
|
||
## Next Steps: | ||
|
||
For a more complex example, please see the [TestApp](https://github.com/scribd/armadillo/tree/main/TestApp) included in the library. If | ||
you have any problems, don’t be afraid to open up an issue [on | ||
GitHub](https://github.com/scribd/armadillo). | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use an icon if we have to attribute it like this. If this is mandatory, then we need a new image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Icon has been removed and updated with one that we own.