use of butter.droid.base.providers.media.model.MediaWrapper 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();
}
});
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class TVTrailerPlayerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, 0);
final Intent intent = getIntent();
final MediaWrapper media = intent.getParcelableExtra(EXTRA_MEDIA);
final String youtubeUrl = intent.getStringExtra(EXTRA_URI);
if (savedInstanceState == null) {
TVTrailerPlayerFragment fragment = TVTrailerPlayerFragment.newInstance(media, youtubeUrl);
getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
}
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class TVMediaGridPresenterImpl method loadItems.
private void loadItems(@Nullable String endCursor) {
cancelCurrentCall();
providerManager.getMediaProvider(providerId).items(filter, new Pager(endCursor)).flatMap(i -> Single.zip(Single.just(i).map(ItemsWrapper::getMedia).flatMapObservable(Observable::fromIterable).map(media -> new MediaWrapper(media, providerId)).map(MediaCardItem::new).toList(), Single.just(i).map(ItemsWrapper::getPaging), Pair::create)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<Pair<List<MediaCardItem>, Paging>>() {
@Override
public void onSubscribe(final Disposable d) {
currentCall = d;
}
@Override
public void onSuccess(final Pair<List<MediaCardItem>, Paging> value) {
view.appendItems(value.first, !value.second.hasNextPage(), value.second.getEndCursor());
}
@Override
public void onError(final Throwable e) {
view.displayError("Error getting show list");
}
});
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class TVShowDetailsFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle arguments = getArguments();
final MediaWrapper item = arguments.getParcelable(EXTRA_ITEM);
presenter.onCreate(item);
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class TVLaunchActivity method navigateForward.
@Override
public void navigateForward() {
String action = getIntent().getAction();
Uri data = getIntent().getData();
if (action != null && action.equals(Intent.ACTION_VIEW) && data != null) {
String streamUrl = data.toString();
try {
streamUrl = URLDecoder.decode(streamUrl, "utf-8");
final Media media = new Clip("0", streamUrl, -1, new Genre[0], -1, null, "", "", streamUrl);
TVStreamLoadingActivity.startActivity(this, new StreamInfo(streamUrl, new MediaWrapper(media, -1), null));
finish();
return;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
TVMainActivity.startActivity(this);
finish();
}
Aggregations