Added support for local external video files
This commit is contained in:
parent
dcbf334bad
commit
248467d840
|
@ -326,6 +326,15 @@
|
|||
android:name=".activity.VideoplayerActivity"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
android:screenOrientation="landscape" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:mimeType="video/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.PlaybackHistoryActivity"
|
||||
|
|
|
@ -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. */
|
||||
|
@ -54,14 +56,35 @@ 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue