summaryrefslogtreecommitdiff
path: root/src/de/danoeh
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-02-28 12:38:56 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2013-02-28 12:38:56 +0100
commit248467d840391da6b0c9c3f7a7eca19398880896 (patch)
tree8d7718314a58c8956d124326b575f6502d0dbe28 /src/de/danoeh
parentdcbf334bad1533debe0141812b3efabbde8d7d18 (diff)
downloadAntennaPod-248467d840391da6b0c9c3f7a7eca19398880896.zip
Added support for local external video files
Diffstat (limited to 'src/de/danoeh')
-rw-r--r--src/de/danoeh/antennapod/activity/VideoplayerActivity.java27
-rw-r--r--src/de/danoeh/antennapod/util/playback/Playable.java14
2 files changed, 35 insertions, 6 deletions
diff --git a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
index a663d1012..2d9834a3e 100644
--- a/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
+++ b/src/de/danoeh/antennapod/activity/VideoplayerActivity.java
@@ -19,9 +19,11 @@ import com.actionbarsherlock.view.Window;
import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R;
+import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.preferences.UserPreferences;
import de.danoeh.antennapod.service.PlaybackService;
import de.danoeh.antennapod.service.PlayerStatus;
+import de.danoeh.antennapod.util.playback.ExternalMedia;
import de.danoeh.antennapod.util.playback.Playable;
/** Activity for playing audio files. */
@@ -55,13 +57,34 @@ public class VideoplayerActivity extends MediaplayerActivity implements
}
@Override
+ protected void onResume() {
+ super.onResume();
+ if (getIntent().getAction() != null
+ && getIntent().getAction().equals(Intent.ACTION_VIEW)) {
+ Intent intent = getIntent();
+ if (AppConfig.DEBUG)
+ Log.d(TAG, "Received VIEW intent: "
+ + intent.getData().getPath());
+ ExternalMedia media = new ExternalMedia(intent.getData().getPath(),
+ MediaType.VIDEO);
+ Intent launchIntent = new Intent(this, PlaybackService.class);
+ launchIntent.putExtra(PlaybackService.EXTRA_PLAYABLE, media);
+ launchIntent.putExtra(PlaybackService.EXTRA_START_WHEN_PREPARED,
+ true);
+ launchIntent.putExtra(PlaybackService.EXTRA_SHOULD_STREAM, false);
+ launchIntent.putExtra(PlaybackService.EXTRA_PREPARE_IMMEDIATELY,
+ true);
+ startService(launchIntent);
+ }
+ }
+
+ @Override
protected void loadMediaInfo() {
super.loadMediaInfo();
Playable media = controller.getMedia();
if (media != null) {
getSupportActionBar().setSubtitle(media.getEpisodeTitle());
- getSupportActionBar()
- .setTitle(media.getFeedTitle());
+ getSupportActionBar().setTitle(media.getFeedTitle());
}
}
diff --git a/src/de/danoeh/antennapod/util/playback/Playable.java b/src/de/danoeh/antennapod/util/playback/Playable.java
index c92b3cfef..ba2674d9b 100644
--- a/src/de/danoeh/antennapod/util/playback/Playable.java
+++ b/src/de/danoeh/antennapod/util/playback/Playable.java
@@ -67,7 +67,10 @@ public interface Playable extends Parcelable {
/** Return position of object or 0 if position is unknown. */
public int getPosition();
- /** Returns the type of media. */
+ /**
+ * Returns the type of media. This method should return the correct value
+ * BEFORE loadMetadata() is called.
+ */
public MediaType getMediaType();
/**
@@ -151,11 +154,14 @@ public interface Playable extends Parcelable {
}
break;
case ExternalMedia.PLAYABLE_TYPE_EXTERNAL_MEDIA:
- String source = pref.getString(ExternalMedia.PREF_SOURCE_URL, null);
- String mediaType = pref.getString(ExternalMedia.PREF_MEDIA_TYPE, null);
+ String source = pref.getString(ExternalMedia.PREF_SOURCE_URL,
+ null);
+ String mediaType = pref.getString(
+ ExternalMedia.PREF_MEDIA_TYPE, null);
if (source != null && mediaType != null) {
int position = pref.getInt(ExternalMedia.PREF_POSITION, 0);
- return new ExternalMedia(source,MediaType.valueOf(mediaType), position);
+ return new ExternalMedia(source,
+ MediaType.valueOf(mediaType), position);
}
break;
}