use of com.frostwire.search.StreamableSearchResult in project frostwire by frostwire.
the class SearchResultActionsRenderer method isSearchResultPlayable.
private boolean isSearchResultPlayable() {
boolean playable = false;
if (searchResult.getSearchResult() instanceof StreamableSearchResult) {
playable = ((StreamableSearchResult) searchResult.getSearchResult()).getStreamUrl() != null;
}
if (playable && searchResult.getExtension() != null) {
MediaType mediaType = MediaType.getMediaTypeForExtension(searchResult.getExtension());
playable = mediaType != null && (mediaType.equals(MediaType.getAudioMediaType())) || mediaType.equals(MediaType.getVideoMediaType());
}
return playable;
}
use of com.frostwire.search.StreamableSearchResult in project frostwire by frostwire.
the class AbstractUISearchResult method play.
@Override
public void play() {
// this gets invoked when clicking on a search result play preview button.
if (sr instanceof StreamableSearchResult) {
StreamableSearchResult ssr = (StreamableSearchResult) sr;
String streamUrl = ssr.getStreamUrl();
MediaType mediaType = MediaType.getMediaTypeForExtension(extension);
if (mediaType != null) {
boolean isVideo = mediaType.equals(MediaType.getVideoMediaType());
if (isVideo) {
boolean videoPreviewInBrowser = !PlayerSettings.USE_FW_PLAYER_FOR_CLOUD_VIDEO_PREVIEWS.getValue() && sr instanceof YouTubeCrawledStreamableSearchResult;
if (videoPreviewInBrowser) {
GUIMediator.instance().launchYouTubePreviewInBrowser(((YouTubeCrawledStreamableSearchResult) sr));
} else {
GUIMediator.instance().launchMedia(new StreamMediaSource(streamUrl, sr.getDisplayName(), sr.getDetailsUrl(), true), true);
}
} else {
GUIMediator.instance().launchMedia(new StreamMediaSource(streamUrl, sr.getDisplayName(), sr.getDetailsUrl(), false), true);
}
}
}
}
Aggregations