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.feed.FeedItem;
|
||||
import de.danoeh.antennapod.feed.FeedManager;
|
||||
import de.danoeh.antennapod.feed.MediaType;
|
||||
import de.danoeh.antennapod.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.util.Converter;
|
||||
import de.danoeh.antennapod.util.EpisodeFilter;
|
||||
|
@ -135,11 +136,10 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
|
|||
holder.downloading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String type = item.getMedia().getMime_type();
|
||||
|
||||
if (type.startsWith("audio")) {
|
||||
MediaType mediaType = item.getMedia().getMediaType();
|
||||
if (mediaType == MediaType.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);
|
||||
} else {
|
||||
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
|
||||
public int getTypeAsInt() {
|
||||
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.FeedManager;
|
||||
import de.danoeh.antennapod.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.feed.MediaType;
|
||||
import de.danoeh.antennapod.receiver.MediaButtonReceiver;
|
||||
import de.danoeh.antennapod.receiver.PlayerWidget;
|
||||
import de.danoeh.antennapod.util.ChapterUtils;
|
||||
|
@ -184,7 +185,8 @@ public class PlaybackService extends Service {
|
|||
*/
|
||||
public static Intent getPlayerActivityIntent(Context context,
|
||||
FeedMedia media) {
|
||||
if (media.getMime_type().startsWith("video")) {
|
||||
MediaType mt = media.getMediaType();
|
||||
if (mt == MediaType.VIDEO) {
|
||||
return new Intent(context, VideoplayerActivity.class);
|
||||
} else {
|
||||
return new Intent(context, AudioplayerActivity.class);
|
||||
|
@ -475,7 +477,8 @@ public class PlaybackService extends Service {
|
|||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Setting up media player");
|
||||
try {
|
||||
if (media.getMime_type().startsWith("audio")) {
|
||||
MediaType mediaType = media.getMediaType();
|
||||
if (mediaType == MediaType.AUDIO) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Mime type is audio");
|
||||
playingVideo = false;
|
||||
|
@ -488,7 +491,7 @@ public class PlaybackService extends Service {
|
|||
setStatus(PlayerStatus.PREPARING);
|
||||
player.prepare();
|
||||
}
|
||||
} else if (media.getMime_type().startsWith("video")) {
|
||||
} else if (mediaType == MediaType.VIDEO) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Mime type is video");
|
||||
playingVideo = true;
|
||||
|
@ -660,10 +663,10 @@ public class PlaybackService extends Service {
|
|||
stopWidgetUpdater();
|
||||
}
|
||||
int notificationCode = 0;
|
||||
if (media.getMime_type().startsWith("audio")) {
|
||||
if (media.getMediaType() == MediaType.AUDIO) {
|
||||
notificationCode = EXTRA_CODE_AUDIO;
|
||||
playingVideo = false;
|
||||
} else if (media.getMime_type().startsWith("video")) {
|
||||
} else if (media.getMediaType() == MediaType.VIDEO) {
|
||||
notificationCode = EXTRA_CODE_VIDEO;
|
||||
}
|
||||
resetVideoSurface();
|
||||
|
|
|
@ -39,7 +39,7 @@ public class NSRSS20 extends Namespace {
|
|||
public final static String ENC_LEN = "length";
|
||||
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
|
||||
public SyndElement handleElementStart(String localName, HandlerState state,
|
||||
|
|
Loading…
Reference in New Issue