Log in or register to post comments

play youtube video

December 24, 2013 - 4:20am #1

how can i play youtube video in video playback example?

play youtube video

March 29, 2019 - 2:35am #6

In class VideoPlayBack there is a method onSingleTapConfirmed

put this code inside it and enjoy youtube or any link......


                boolean isSingleTapHandled = false;

                // Do not react if the StartupScreen is being displayed

                for (int i = 0; i < NUM_TARGETS; i++)


                    // Verify that the tap happened inside the target

                    if (mRenderer!= null && mRenderer.isTapOnScreenInsideTarget(i, e.getX(),




                        if (i == 0)


                       Intent intra = new Intent(Intent.ACTION_VIEW);

                            intra.setData(Uri.parse("put ljnk here"));





                        if (i == 1)


                            Intent intr = new Intent(Intent.ACTION_VIEW);

                            intr.setData(Uri.parse("put ljnk here"));



                        if (i == 2)


                            Intent intr1 = new Intent(Intent.ACTION_VIEW);

                            intr1.setData(Uri.parse("https://yput ljnk here"));"));




                        //------ FUllScreen remove.... just uncomment  the below code


                        // Check if it is playable on texture

                       /* if (mVideoPlayerHelper[i].isPlayableOnTexture())


                            // We can play only if the movie was paused, ready

                            // or stopped

                            if ((mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.PAUSED)

                                || (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.READY)

                                || (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.STOPPED)

                                || (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.REACHED_END))


                                // Pause all other media



                                // If it has reached the end then rewind

                                if ((mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.REACHED_END))

                                    mSeekPosition[i] = 0;




                                mSeekPosition[i] = VideoPlayerHelper.CURRENT_POSITION;

                            } else if (mVideoPlayerHelper[i].getStatus() == MEDIA_STATE.PLAYING)


                                // If it is playing then we pause it



                        } else*/ if (mVideoPlayerHelper[i].isPlayableFullscreen())


                            // If it isn't playable on texture

                            // Either because it wasn't requested or because it

                            // isn't supported then request playback fullscreen.





                        isSingleTapHandled = true;


                        // Even though multiple videos can be loaded only one

                        // can be playing at any point in time. This break

                        // prevents that, say, overlapping videos trigger

                        // simultaneously playback.





                return isSingleTapHandled;


play youtube video

December 25, 2015 - 7:50pm #5

Can we play Youtube Video on Texture in Android ??? is it Possible to do that?? If so plz Show a way ..

play youtube video

September 29, 2014 - 2:45am #4

Note that a developer has shared an approach using some library called YouTubeAndroidPlayerApi available at https://developers.google.com/youtube/android/player/

in this thread here:




play youtube video

December 24, 2013 - 4:26am #3

Youtube video URLs usually do not point explicitely to a video file (such as ".mp4" or ".m4v" files), i.e. the URL itself does not contain a path to a video file;

the video playback sample requires you to have an explicit video file path in the URL,




play youtube video

December 24, 2013 - 4:26am #2

Search the forums, as this has been asked before.

Basically you can't really do this because the sample plays back remote video files from a web server that enforces the live stream video protocol for video files. Youtube does not do this, but you can set your own one up.  However this is outside the scope of forum support.



Log in or register to post comments