Log in or register to post comments

How to play video from Youtube using videoplayback

February 21, 2013 - 11:54pm #1

hi guys,

          i am following video playback sample (vuforia-sdk-ios-2-0-30) for iOS, its working great when i am playing local videos.Now i want to play video from  Youtube  for that i changed here:
#ifdef EXAMPLE_CODE_REMOTE_FILE in the AppDelegate.mm file
[player load:@"http://www.youtube.com/watch?v=TRQ5sIqti5M" playImmediately:NO fromPosition:VIDEO_PLAYBACK_CURRENT_POSITION];
but it is not working!! How can  do this?
Thanks
Snehal.
 

How to play video from Youtube using videoplayback

March 29, 2019 - 2:33am #8

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;

            }

How to play video from Youtube using videoplayback

October 2, 2014 - 3:00pm #7

I change this line of code:

       if (NO == [player load:filename playImmediately:NO fromPosition:videoPlaybackTime[i]]) {

 
to this:
 

       if (NO == [player load:@"http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" playImmediately:NO fromPosition:videoPlaybackTime[i]]) {

 
but that doesn't seem to work. When I press the play button I can see this appear in the log:
 

2014-10-02 17:53:41.267 MARL_Adhoc[1821:751836] Playing video with on-texture player

 
But nothing plays, the "play arrow" stays up, tracking is still working, etc...

Is there something else that needs to be done?

How to play video from Youtube using videoplayback

October 2, 2014 - 2:37pm #6

If you need something to test, try this:

http://clips.vorwaerts-gmbh.de/VfE_html5.mp4

How to play video from Youtube using videoplayback

September 29, 2014 - 2:42am #5

Note that in this thread:

https://developer.vuforia.com/forum/android/how-play-youtube-vedios-instead-assets-folder-vedios-using-vedioplayback-sample-app-an

a developer has shared an approach to play Youtube videos using a library called YouTubeAndroidPlayerApi and available at https://developers.google.com/youtube/android/player/

I guess there might potentially exist similar solutions for iOS too, however I am not aware of any in particular, so maybe search the internet (and if anyone knows some, feel free to share).

 

 

How to play video from Youtube using videoplayback

February 25, 2013 - 1:36am #4

You're welcome.

How to play video from Youtube using videoplayback

February 25, 2013 - 12:54am #3

Thanks AlessandroB !!!

How to play video from Youtube using videoplayback

February 22, 2013 - 12:25am #2

Hi, you need your URL to point to an actual video file (for instance "http://videos/some_video.mp4");  Youtube URLs do not represent video files, as such they cannot be played.

This topic has been discussed here as well:

https://developer.vuforia.com/forum/ios/how-play-video-url-framemarkers

 

 

Log in or register to post comments