Search in sources :

Example 1 with Clip

use of butter.droid.provider.base.model.Clip in project butter-android by butterproject.

the class VideoPlayerPresenterImpl method onCreate.

@Override
public void onCreate(final StreamInfo streamInfo, final long resumePosition, final String action, final Intent intent) {
    if (Intent.ACTION_VIEW.equals(action)) {
        String videoLocation = StreamInfoUtils.getActionViewVideoLocation(contentResolver, intent);
        if (videoLocation != null) {
            final Media media = new Clip("0", videoLocation, -1, new Genre[0], -1, "", "", "", videoLocation);
            this.streamInfo = new StreamInfo(videoLocation, new MediaWrapper(media, -1), null);
            this.resumePosition = intent.getLongExtra("position", 0);
            view.showVideoFragment(this.streamInfo, this.resumePosition);
        } else {
        // TODO: 4/2/17 Show error
        }
    } else {
        this.streamInfo = streamInfo;
        this.resumePosition = resumePosition;
        if (streamInfo == null) {
            throw new IllegalStateException("StreamInfo has to be provided");
        }
        view.showVideoFragment(streamInfo, resumePosition);
    }
}
Also used : Clip(butter.droid.provider.base.model.Clip) MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Media(butter.droid.provider.base.model.Media) StreamInfo(butter.droid.base.providers.media.model.StreamInfo)

Example 2 with Clip

use of butter.droid.provider.base.model.Clip 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();
}
Also used : Clip(butter.droid.provider.base.model.Clip) MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Media(butter.droid.provider.base.model.Media) StreamInfo(butter.droid.base.providers.media.model.StreamInfo) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Uri(android.net.Uri)

Example 3 with Clip

use of butter.droid.provider.base.model.Clip in project butter-android by butterproject.

the class MainActivity method checkActions.

private void checkActions() {
    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");
            // TODO: 7/29/17 Check if actual torrent
            final Media clip = new Clip("0", streamUrl, 0, new Genre[0], -1, "", "", "", streamUrl);
            StreamLoadingActivity.startActivity(this, new StreamInfo(streamUrl, new MediaWrapper(clip, -1), null));
            finish();
        } catch (UnsupportedEncodingException e) {
            // this should never happen
            Timber.d("Unknown encoding");
        }
    }
}
Also used : Clip(butter.droid.provider.base.model.Clip) MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Media(butter.droid.provider.base.model.Media) StreamInfo(butter.droid.base.providers.media.model.StreamInfo) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Uri(android.net.Uri)

Aggregations

MediaWrapper (butter.droid.base.providers.media.model.MediaWrapper)3 StreamInfo (butter.droid.base.providers.media.model.StreamInfo)3 Clip (butter.droid.provider.base.model.Clip)3 Media (butter.droid.provider.base.model.Media)3 Uri (android.net.Uri)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2