Search in sources :

Example 1 with StreamableSearchResult

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;
}
Also used : MediaType(com.limegroup.gnutella.MediaType) StreamableSearchResult(com.frostwire.search.StreamableSearchResult)

Example 2 with StreamableSearchResult

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);
            }
        }
    }
}
Also used : MediaType(com.limegroup.gnutella.MediaType) YouTubeCrawledStreamableSearchResult(com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult) StreamMediaSource(com.frostwire.gui.player.StreamMediaSource) StreamableSearchResult(com.frostwire.search.StreamableSearchResult) YouTubeCrawledStreamableSearchResult(com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult)

Aggregations

StreamableSearchResult (com.frostwire.search.StreamableSearchResult)2 MediaType (com.limegroup.gnutella.MediaType)2 StreamMediaSource (com.frostwire.gui.player.StreamMediaSource)1 YouTubeCrawledStreamableSearchResult (com.frostwire.search.youtube.YouTubeCrawledStreamableSearchResult)1