use of com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult 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