Log in or register to post comments

How to play a youtube video on video Play Back Sample 2-0-6

January 16, 2013 - 2:04am #1

I really appreciate Vuforia for Video Play Back feature provided for ios and it works great!!! :)

Everything is fine my only problem is  how to play a youtube video on video Play Back Sample  2-0-6 instead of playing a video from Document Directory.

Has anyone achieved it and please let me know how it can be done.

 

Thanks,

Dalee Davis

How to play a youtube video on video Play Back Sample 2-0-6

March 29, 2019 - 2:34am #22

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 a youtube video on video Play Back Sample 2-0-6

April 8, 2015 - 10:21pm #21
for all who have sought dilemma play videos from youtube, I tell them my experience, although the youtube, does not give you the actual links but URL Short, it will not be possible to simply copying the link youtube and pasting Vuforia the patch.
 
have q seek the true bond, this is done with programs like IDM and video will be played smoothly, but here's not all, when everything seemed to go fine, youtube, gives you a "temporary" link of your video and the next day it updated so that happiness does not last long and still can not reproduce smooth video from youtube, I hope you serve something, greetings.

How to play a youtube video on video Play Back Sample 2-0-6

July 17, 2014 - 12:20am #20

HI 

 

CAN YOU PLEASE LET ME KNOW THE FILE NAME WHERE THE CHANGES FOR VIDEO URL TO BE DONE SO THAT I CAN SEEK VIDEO FROM YOUTUBE BY PASSING THE URL AND PLAY IN UIWEBVIEW.

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 5:29am #19

Hi Nalin,

 

Thanks for your help! i have already created a isolated project and it works as well.

 

But i am not able to figure out in Vuforia how will i add a UIWebview when a target is detected and how will i specify its frame(i.e. x, y cordinates)

I want the same the frame size that comes in the default video playback sample provided.

 

Edit:- I know there's a method in VPParentViewController

 - (void)addMoviePlayerViewToMainView:(UIView*)view

but in this method it only accepts a view, i am unable to specify the frame.

Any help will be appreciated:)

Thanks,

Dalee Davis

 

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 5:09am #18

Re UIWebview - your best bet is to get this working in isolation first i.e. without Vuforia, so do a web search as there should be plenty of info.

Next you will need to find a way to integrate the code - where it triggers the movie player, change it to trigger the web view with the video.

 

Regarding videos per se, you need to come up with your own strategies that work bearing in mind any legal, copyright or technical issues - we cannot advise here.

Hope you can understand.

N

 

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 5:03am #17

@Nalin- Ok alright then may be  because even i am using ios6.

I an sorry , currently i dont have a device running on iOS 5 to test that.

 

Thanks,

Dalee Davis

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:59am #16

Hi Nalin,

 Ok  that means we can't directly play a youtube video only way is to download it on the remote server and play right?

 

And yaa thanks for the information about the videos allowed to be downloaded.

and the other option you can gave about UIWebview i am very keen on accepting that and can you please help me out how to add that instead of Movie Player

and how will i define its frame.

Kindly help me.

 

Thanks,

Dalee Davis

 

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:56am #15

We are currently investigating this issue, which i think is specific to iOS6 devices - can you confirm?

iOS5 seems to be fine.

N

 

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:54am #14

Hi Alessandro/Nalin,

I also have an another issue when i play a video from remote server it plays in fullscreen and also when the video ends i am unable to exit the player and can't get back to the app.I have to exit the whole app and restart it again!

It shows a black screen with player on it and none of them responds to click.This happens in iOS.

I can attach the screenshot if you want but tell me hw do i attach it:)

 

Thanks,

Dalee Davis

 

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:47am #13

Hi Dalee

At present unfortunately there is no way to directly play a youtube video with MPMoviePlayerController because Youtube does not expose direct links to the video files, possibly due to commercial iussue such as 1) legal 2) advertising etc.

You can try logging this as a feature request, but due to the technical issue above and it is highly unlikely to happen.

The only possible way around this might be to spin off a UIWebView with the URL of the video and then it might work, but the overall experience may not be what you are after.

N

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:40am #12

Yaa i surely can but will Nalin or you be able to co-ordinate on adding a youtube URL on video-playback on iOS.

Thanks,

Dalee Davis

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:37am #11

OK, perfect, you can follow up the discussion there then.

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 4:31am #10

Hi Alessandro,

 

Yaa i know beacuse after i commented there i realised that post was in android so here i started a new thread in iOS because i wanted to accompolish this task in iPhone and not in android:)
 
 
 
Thanks,
 
Dalee Davis

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 3:41am #9

Hi Dalee, the Youtube URL topic is addressed in this thread (that you're following too):

https://developer.vuforia.com/forum/issues-and-bugs/it-possible-stream-video-url-video-playback-example

How to play a youtube video on video Play Back Sample 2-0-6

January 22, 2013 - 2:02am #8

Hi Nalin,

 

          I tried it with remote server URL and it works and loads fine on full screen that means it works with URL's but i am not able to figure out for youtube URL's

Kindly help me.

 

Thanks,

Dalee Davis

 Hi Nalin, i tried it with

January 21, 2013 - 5:12am #7

 

Hi Nalin,

     i tried it with this URL as well  http://music.ece.drexel.edu/~mzimmerman/OCPCarmen/oldEmbed.htm.

    But still the same. is it something i am doing wrong? I have so far uncommented the definition and specified this URL in the URL section.

 

Thanks,

Dalee Davis

Hi Dalee, I know some have

January 21, 2013 - 4:42am #6

Hi Dalee,

I know some have had issues with Youtube URLs.

Could you try this with a URL to a video hosted on your own server / drop box and see if this works? so we can narrow this down...

thanks,

N

Hi Nalin,Thanks for your

January 20, 2013 - 11:31pm #5

Hi Nalin,

Thanks for your response!

i tried uncommenting the definition and i added the URL too for youtube.. but still i dont see anything i see the vuforia image with a play button when i click on play it shows the hourglass image and nothing else. I am trying with this link http://www.youtube.com/embed/-0Xa4bHcJu8

And i have pasted the log here. Kindly help me.

 

2013-01-21 11:45:56.480 VideoPlay[9115:907] Playing video with native player

2013-01-21 11:45:56.533 VideoPlay[9115:907] [MPAVController] Autoplay: Disabling autoplay for pause

2013-01-21 11:45:56.534 VideoPlay[9115:907] [MPAVController] Autoplay: Disabling autoplay

2013-01-21 11:45:56.563 VideoPlay[9115:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)

2013-01-21 11:45:57.274 VideoPlay[9115:907] [MPAVController] Autoplay: Enabling autoplay

2013-01-21 11:45:57.295 VideoPlay[9115:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0

2013-01-21 11:45:57.297 VideoPlay[9115:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.

2013-01-21 11:45:57.300 VideoPlay[9115:907] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0

2013-01-21 11:45:57.311 VideoPlay[9115:907] [MPAVController] Autoplay: Enabling autoplay

2013-01-21 11:45:57.344 VideoPlay[9115:907] moviePlayerPlaybackDidFinish

2013-01-21 11:45:57.345 VideoPlay[9115:907] moviePlayerPlaybackDidFinish -> MPMovieFinishReasonPlaybackError

2013-01-21 11:45:57.346 VideoPlay[9115:907] moviePlayerExitAtPosition: 0.000000

 

Thanks,

Dalee Davis

"I tried to load a remote

January 18, 2013 - 5:08am #4

"I tried to load a remote video files from local server working fine in full screen mode"

Good, so the basic code to play from a URL is working.

"youtube video load successfully but not playing only showing busy icon"

I think the problem might be that you have the incorrect Youtube URL.  There is quite a bit of advice on the Web to find out how to discover this, so you probably need to search and experiment a bit with this.  If the basic code to play from a URL is working then you need to discover why Youtube videos do not play, and I suggest you look at this in isolation i.e. try and get it working outside of Vuforia with some standalone sample code.

"what is the maximum possible remote video we can use or load."

Really, this is for you to discover and it depends on the design of your application, and to some extent the capabilities of the device.  Some developers have implemented a mechanism to download / display video on the fly i.e. without any real limitation.

HTH

N

Hi Nalin, I tried to load a

January 17, 2013 - 4:08am #3

Hi Nalin,

I tried to load a remote video files from local server working fine in full screen mode, youtube video load successfully but not playing only showing busy icon. Please help me to fix this issue and what is the maximum possible remote video we can use or load.

 

Thanks,

P.Uthaman

Hi Dalee, In theory the

January 16, 2013 - 7:14am #2

Hi Dalee,

In theory the sample code should support this.

Search for EXAMPLE_CODE_REMOTE_FILE in the source code and insert a URL instead after you have uncommented the definition.

Some have had problems with this, so let me know how you get on.

cheers

N

Log in or register to post comments