use of butter.droid.provider.subs.SubsProvider in project butter-android by butterproject.
the class StreamPlayerPresenterImpl method loadSubtitle.
private void loadSubtitle() {
SubtitleWrapper subtitle = streamInfo.getSubtitle();
MediaWrapper media = streamInfo.getMedia();
SubsProvider provider = providerManager.getSubsProvider(media.getProviderId());
subtitleManager.downloadSubtitle(provider, media.getMedia(), subtitle).observeOn(AndroidSchedulers.mainThread()).subscribe(new MaybeObserver<SubtitleWrapper>() {
@Override
public void onSubscribe(final Disposable d) {
disposeSubs();
subsDisposable = d;
}
@Override
public void onSuccess(final SubtitleWrapper subs) {
loadSubs(subs.getFileUri());
}
@Override
public void onError(final Throwable e) {
// TODO show error loading subs
Timber.d("Error loading subs");
}
@Override
public void onComplete() {
Timber.d("Maybe empty");
}
});
}
use of butter.droid.provider.subs.SubsProvider in project butter-android by butterproject.
the class BaseStreamLoadingFragmentPresenterImpl method loadSubtitles.
/**
* Downloads the subs file
*/
private void loadSubtitles() {
MediaWrapper media = streamInfo.getMedia();
SubsProvider subsProvider = providerManager.getSubsProvider(media.getProviderId());
SubtitleWrapper subtitle = streamInfo.getSubtitle();
// TODO dispose
subtitleManager.downloadSubtitle(subsProvider, media.getMedia(), subtitle).observeOn(AndroidSchedulers.mainThread()).subscribe(new MaybeObserver<SubtitleWrapper>() {
@Override
public void onSubscribe(final Disposable d) {
subtitleDisposable = d;
}
@Override
public void onSuccess(final SubtitleWrapper wrapper) {
subtitleDisposable = null;
startPlayer();
}
@Override
public void onError(final Throwable e) {
subtitleDisposable = null;
startPlayer();
}
@Override
public void onComplete() {
subtitleDisposable = null;
startPlayer();
}
});
}
Aggregations