cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Youtube Video play

RG_10041320
6-Contributor

Youtube Video play

Hello,

 

It is possible to play a video from youtube with just URL, without download it?

 

Thank you

2 REPLIES 2

Try the following solution ( link: https://developer.vuforia.com/forum/android/play-youtube-video ), quote: "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(),

                        e.getY()))

                    {

                    

                        if (i == 0)

                        {

                       Intent intra = new Intent(Intent.ACTION_VIEW);

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

                            startActivity(intra);

                        }

 

                        }

                        if (i == 1)

                        {

                            Intent intr = new Intent(Intent.ACTION_VIEW);

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

                            startActivity(intr);

                        }

                        if (i == 2)

                        {

                            Intent intr1 = new Intent(Intent.ACTION_VIEW);

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

                            startActivity(intr1);

                        }

 

                        //------ 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

                                pauseAll(i);

                              

                                // If it has reached the end then rewind

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

                                    mSeekPosition[i] = 0;

                              

                                mVideoPlayerHelper[i].play(mPlayFullscreenVideo,

                                    mSeekPosition[i]);

                                mSeekPosition[i] = VideoPlayerHelper.CURRENT_POSITION;

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

                            {

                                // If it is playing then we pause it

                                mVideoPlayerHelper[i].pause();

                            }

                        } 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.

                            mVideoPlayerHelper[i].play(true,

                                VideoPlayerHelper.CURRENT_POSITION);

                        }

                      

                        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.

                        break;

                    }

                }

              

                return isSingleTapHandled;

            }

Announcements

Top Tags