Skip to content

Instantly share code, notes, and snippets.

View yiyocx's full-sized avatar

Yiyo Castillo yiyocx

View GitHub Profile
@yiyocx
yiyocx / RxMediaPlayer.java
Last active March 1, 2024 15:46
Android MediaPlayer class meets RxJava. This class was based in the example of the blog post: http://adelnizamutdinov.github.io/blog/2015/01/23/using-rxjavas-observable-semantics-for-greater-good/ but was updated to use fromCallable(), pure Java 7 (no retrolambda), notifies elapsed and total time when starts playing audio. It supports streaming …
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.support.annotation.NonNull;
import android.support.v4.util.Pair;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
@yiyocx
yiyocx / RxMediaRecorder.java
Last active October 24, 2016 22:44
Android MediaRecorder class meets RxJava. This class was based in the example of the blog post: http://adelnizamutdinov.github.io/blog/2015/01/23/using-rxjavas-observable-semantics-for-greater-good/ but was updated to use fromCallable(), pure Java 7 (no retrolambda) and notifies elapsed time since recording starts.
import android.media.MediaRecorder;
import android.support.annotation.NonNull;
import java.io.File;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;