Added support for application/ogg MIME type
This commit is contained in:
parent
3cd64399cf
commit
d39bd6831b
|
@ -20,6 +20,7 @@ import de.danoeh.antennapod.PodcastApp;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.feed.FeedItem;
|
import de.danoeh.antennapod.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
import de.danoeh.antennapod.feed.FeedManager;
|
||||||
|
import de.danoeh.antennapod.feed.MediaType;
|
||||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||||
import de.danoeh.antennapod.util.Converter;
|
import de.danoeh.antennapod.util.Converter;
|
||||||
import de.danoeh.antennapod.util.EpisodeFilter;
|
import de.danoeh.antennapod.util.EpisodeFilter;
|
||||||
|
@ -135,11 +136,10 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
||||||
holder.downloading.setVisibility(View.GONE);
|
holder.downloading.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
String type = item.getMedia().getMime_type();
|
MediaType mediaType = item.getMedia().getMediaType();
|
||||||
|
if (mediaType == MediaType.AUDIO) {
|
||||||
if (type.startsWith("audio")) {
|
|
||||||
holder.type.setImageResource(R.drawable.type_audio);
|
holder.type.setImageResource(R.drawable.type_audio);
|
||||||
} else if (type.startsWith("video")) {
|
} else if (mediaType == MediaType.VIDEO) {
|
||||||
holder.type.setImageResource(R.drawable.type_video);
|
holder.type.setImageResource(R.drawable.type_video);
|
||||||
} else {
|
} else {
|
||||||
holder.type.setImageBitmap(null);
|
holder.type.setImageBitmap(null);
|
||||||
|
|
|
@ -45,6 +45,22 @@ public class FeedMedia extends FeedFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Uses mimetype to determine the type of media. */
|
||||||
|
public MediaType getMediaType() {
|
||||||
|
if (mime_type == null || mime_type.isEmpty()) {
|
||||||
|
return MediaType.UNKNOWN;
|
||||||
|
} else {
|
||||||
|
if (mime_type.startsWith("audio")) {
|
||||||
|
return MediaType.AUDIO;
|
||||||
|
} else if (mime_type.startsWith("video")) {
|
||||||
|
return MediaType.VIDEO;
|
||||||
|
} else if (mime_type.equals("application/ogg")) {
|
||||||
|
return MediaType.AUDIO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MediaType.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTypeAsInt() {
|
public int getTypeAsInt() {
|
||||||
return FEEDFILETYPE_FEEDMEDIA;
|
return FEEDFILETYPE_FEEDMEDIA;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package de.danoeh.antennapod.feed;
|
||||||
|
|
||||||
|
public enum MediaType {
|
||||||
|
AUDIO, VIDEO, UNKNOWN
|
||||||
|
}
|
|
@ -43,6 +43,7 @@ import de.danoeh.antennapod.feed.Feed;
|
||||||
import de.danoeh.antennapod.feed.FeedItem;
|
import de.danoeh.antennapod.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.feed.FeedManager;
|
import de.danoeh.antennapod.feed.FeedManager;
|
||||||
import de.danoeh.antennapod.feed.FeedMedia;
|
import de.danoeh.antennapod.feed.FeedMedia;
|
||||||
|
import de.danoeh.antennapod.feed.MediaType;
|
||||||
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
|
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
|
||||||
import de.danoeh.antennapod.receiver.PlayerWidget;
|
import de.danoeh.antennapod.receiver.PlayerWidget;
|
||||||
import de.danoeh.antennapod.util.ChapterUtils;
|
import de.danoeh.antennapod.util.ChapterUtils;
|
||||||
|
@ -184,7 +185,8 @@ public class PlaybackService extends Service {
|
||||||
*/
|
*/
|
||||||
public static Intent getPlayerActivityIntent(Context context,
|
public static Intent getPlayerActivityIntent(Context context,
|
||||||
FeedMedia media) {
|
FeedMedia media) {
|
||||||
if (media.getMime_type().startsWith("video")) {
|
MediaType mt = media.getMediaType();
|
||||||
|
if (mt == MediaType.VIDEO) {
|
||||||
return new Intent(context, VideoplayerActivity.class);
|
return new Intent(context, VideoplayerActivity.class);
|
||||||
} else {
|
} else {
|
||||||
return new Intent(context, AudioplayerActivity.class);
|
return new Intent(context, AudioplayerActivity.class);
|
||||||
|
@ -475,7 +477,8 @@ public class PlaybackService extends Service {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Setting up media player");
|
Log.d(TAG, "Setting up media player");
|
||||||
try {
|
try {
|
||||||
if (media.getMime_type().startsWith("audio")) {
|
MediaType mediaType = media.getMediaType();
|
||||||
|
if (mediaType == MediaType.AUDIO) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Mime type is audio");
|
Log.d(TAG, "Mime type is audio");
|
||||||
playingVideo = false;
|
playingVideo = false;
|
||||||
|
@ -488,7 +491,7 @@ public class PlaybackService extends Service {
|
||||||
setStatus(PlayerStatus.PREPARING);
|
setStatus(PlayerStatus.PREPARING);
|
||||||
player.prepare();
|
player.prepare();
|
||||||
}
|
}
|
||||||
} else if (media.getMime_type().startsWith("video")) {
|
} else if (mediaType == MediaType.VIDEO) {
|
||||||
if (AppConfig.DEBUG)
|
if (AppConfig.DEBUG)
|
||||||
Log.d(TAG, "Mime type is video");
|
Log.d(TAG, "Mime type is video");
|
||||||
playingVideo = true;
|
playingVideo = true;
|
||||||
|
@ -660,10 +663,10 @@ public class PlaybackService extends Service {
|
||||||
stopWidgetUpdater();
|
stopWidgetUpdater();
|
||||||
}
|
}
|
||||||
int notificationCode = 0;
|
int notificationCode = 0;
|
||||||
if (media.getMime_type().startsWith("audio")) {
|
if (media.getMediaType() == MediaType.AUDIO) {
|
||||||
notificationCode = EXTRA_CODE_AUDIO;
|
notificationCode = EXTRA_CODE_AUDIO;
|
||||||
playingVideo = false;
|
playingVideo = false;
|
||||||
} else if (media.getMime_type().startsWith("video")) {
|
} else if (media.getMediaType() == MediaType.VIDEO) {
|
||||||
notificationCode = EXTRA_CODE_VIDEO;
|
notificationCode = EXTRA_CODE_VIDEO;
|
||||||
}
|
}
|
||||||
resetVideoSurface();
|
resetVideoSurface();
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class NSRSS20 extends Namespace {
|
||||||
public final static String ENC_LEN = "length";
|
public final static String ENC_LEN = "length";
|
||||||
public final static String ENC_TYPE = "type";
|
public final static String ENC_TYPE = "type";
|
||||||
|
|
||||||
public final static String VALID_MIMETYPE = "audio/.*" + "|" + "video/.*";
|
public final static String VALID_MIMETYPE = "audio/.*" + "|" + "video/.*" + "|" + "application/ogg";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SyndElement handleElementStart(String localName, HandlerState state,
|
public SyndElement handleElementStart(String localName, HandlerState state,
|
||||||
|
|
Loading…
Reference in New Issue