Search in sources :

Example 1 with YouTubeCrawledStreamableSearchResult

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);
            }
        }
    }
}
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

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