'How do I check if a Youtube Video is Embeddable?

Im developing an app that will playback youtube videos IF the video is embeddable. Else I want to open it in Youtube.

My code for it looks like this:

holder.mThumbnailImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // Playback in mobile

            Intent sendIntent = new Intent(holder.mContext, YouTubePlayerFragmentActivity.class);
            sendIntent.putExtra("id", video.getId());
            holder.mContext.startActivity(sendIntent);

            // BELOW IS WHAT I WANT TO HAPPEN IF THE VIDEO IS NOT EMBEDDALBE
            // 
            // holder.mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + video.getId())));

        }
    });

Can someone help me out? Do I need to provide more code for you to understand?

Thx



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source