Log in or register to post comments

load video from url in full screen

November 27, 2012 - 7:58am #1

Hi,

I'm trying to modify the videoplayback sample in order to load movie from url. The sample provide the way to do it only for video ontexture. It is possible to perform the same task for the full screen modality?

Thanks

load video from url in full screen

July 10, 2014 - 2:04am #10

Hi,

     I folllowed your steps to give url's in array but i found that setDataSource do not support string arrays values so i converted it to string using toString() but it throws error in PlaybackRender.java.

    Should i have to modify that class also?

load video from url in full screen

December 12, 2012 - 5:11am #9

Hi, happy to hear that it works.

 

About your second question; that might have something to do with the setStatus() function (see VideoPlayback.cpp) which is maybe not being correctly called (this is usually called from Java in the onDrawFrame() method in VideoPlaybackRenderer.java);

 

since you play in fullscreen, probably the setStatus is not called at all and thus the status is not updated correctly;

so, you will need to adjust the App code so that the setStatus() is called somehow from your fullscreen activity or so...

 

 

load video from url in full screen

December 5, 2012 - 7:27am #8

Thank you very much,

now it works, I can load video from Url also in Fullscreen. There is still a problem related to the fullscreen. if you look at the marker, before you have assigned the Url to the markers, it looks like if everything is already setted. The app show on the marker the image of the video with the play icon. In the textureonsurface appears the busy icon. Any suggestion?

load video from url in full screen

December 3, 2012 - 6:49am #7

hi,

I reproduced your setup, and instead of hardcoding the "http://..." url directly in the FullscreenPlayback code, I have put the URLs in the mMovieNames array;

the issue is that there is a bit of code in the VideoPlaybackHelper class which checks if file exists (setting the media player in error state if it does not); and this check is only done for the fullscreen case; so, if you seacrh for the function:

public boolean load(....) in VideoPlaybackHelper.java, you should see a try / catch block with some code like the following:

   try {

        // We need to verify that the file exists

        AssetFileDescriptor afd = mParentActivity.getAssets().openFd(filename);

        afd.close();

    }

    catch (Exception e)

    {

        DebugLog.LOGD("File does not exist");

        mCurrentState = MEDIA_STATE.ERROR;

        mMediaPlayerLock.unlock();

        mSurfaceTextureLock.unlock();

        return false;

    }

 

Just remove (or comment out) all that try / catch block, and then it should be OK.

 

load video from url in full screen

December 3, 2012 - 3:11am #6

Hi,

I have the vuforia1.5.9 sdk and the internet connection is up.

I assign these values to the mMoviename into the on create function in videoplayback.java.

mMovieName[STONES] = "http://realbruz.altervista.org/Vuforia1.m4v";
mMovieName[CHIPS] = "http://realbruz.altervista.org/Vuforia2.m4v";

This is the FullscreenPlayback.java code that doesn't work

 try
            {
                // Create the MediaPlayer and its controller
                mMediaPlayer = new MediaPlayer();
                mMediaController = new MediaController(this);
                mMediaPlayer.setDataSource(mMovieName);
                mMediaPlayer.setDisplay(mHolder);
                mMediaPlayer.prepareAsync();
                mMediaPlayer.setOnPreparedListener(this);
                mMediaPlayer.setOnVideoSizeChangedListener(this);
                mMediaPlayer.setOnErrorListener(this);
                mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

and this is the code working for the on surface texture:

ry
                        {
                            mMediaPlayer = new MediaPlayer();

                           mMediaPlayer.setDataSource(filename);
                            mMediaPlayer.prepareAsync();
                            mMediaPlayer.setOnPreparedListener(this);
                            mMediaPlayer.setOnBufferingUpdateListener(this);
                            mMediaPlayer.setOnCompletionListener(this);
                            mMediaPlayer.setOnErrorListener(this);
                            mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
                            mMediaPlayer.setSurface(new Surface(mSurfaceTexture));
                            canBeOnTexture = true;
                            mShouldPlayImmediately = playOnTextureImmediately;

load video from url in full screen

November 30, 2012 - 2:02am #5

I just realized that the videos in your http URL are the sames as the sample ones;

so I did a test using that HTTP URL (on an Android 2.2 device) and it works perfectly;

this is the code (in FullscreenPlayback.java), just in case you want to double-check:

mMediaPlayer = new MediaPlayer();

                mMediaController = new MediaController(this);

                mMediaPlayer.setDataSource("http://realbruz.altervista.org/Vuforia2.m4v");

                mMediaPlayer.setDisplay(mHolder);

                mMediaPlayer.prepareAsync();

                mMediaPlayer.setOnPreparedListener(this);

                mMediaPlayer.setOnVideoSizeChangedListener(this);

                mMediaPlayer.setOnErrorListener(this);

                mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

 

If you assign the path to those MovieName variables, and then you set the data source using mMovieName,

I would suggest you to Log the value of mMovieName in the code snippet above, so to be sure that the path is actually the same;

(in the code snippet above I have hardcoded the HTTP path, as you can see).

Other than that, I would suggest to double-check that your device has Internet connection enabled, and that you use the latest Vuforia SDk (1.5.9).

 

load video from url in full screen

November 30, 2012 - 12:52am #4

Hi, have you tried with videos taken from the sd card (like the example suggests in the commented code) ?

You could copy the videos that come with the sample into the sdcard (you can use "adb push" for that) and try that;

if that works, then you could replace the sample videos with your own videos (again on the sd card);

and see if it works; this test will highlight if there is a problem with the video when playing in fullscreen mode.

load video from url in full screen

November 29, 2012 - 1:09am #3

Hi, I try to comment and uncomment the lines as suggested by you but it still doesn't work in fullscreenmode It works only with render ontexture. This is mycode:

Here I declare the movie for each markerin the videoplayback.java

mMovieName[STONES] = "http://realbruz.altervista.org/Vuforia1.m4v";

mMovieName[CHIPS] = "http://realbruz.altervista.org/Vuforia2.m4v";

 

This is my coe in FullscreenPlayback

try
            {
                // Create the MediaPlayer and its controller
                mMediaPlayer = new MediaPlayer();
                mMediaController = new MediaController(this);

                // This example shows how to load the movie from the assets folder of the app
                // However, if you would like to load the movie from the sdcard or from a network location
                // simply comment the three lines below
                //AssetFileDescriptor afd = getAssets().openFd(mMovieName);
                //mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
                //afd.close();

                // And uncomment this line
               mMediaPlayer.setDataSource(mMovieName);

                mMediaPlayer.setDisplay(mHolder);
                mMediaPlayer.prepareAsync();
                mMediaPlayer.setOnPreparedListener(this);
                mMediaPlayer.setOnVideoSizeChangedListener(this);
                mMediaPlayer.setOnErrorListener(this);
                mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

            }

When I look at the marker there is always the error.png on the image, while running with render on texture appears the busy.png and after start the video.

 

thanks

load video from url in full screen

November 27, 2012 - 9:41am #2

Hi, you should be able to find the same piece of code that allows you to specify a URL also in the FullscreenPlayback.java class;

This is the relavnt snippet:

 private void createMediaPlayer()

    {

        mMediaPlayerLock.lock();

        mMediaControllerLock.lock();

 

            try

            {

                // Create the MediaPlayer and its controller:

                mMediaPlayer = new MediaPlayer();

                mMediaController = new MediaController(this);

 

                // This example shows how to load the movie from the assets

                // folder of the app. However, if you would like to load the

                // movie from the SD card or from a network location, simply

                // comment the four lines below:

                AssetFileDescriptor afd = getAssets().openFd(mMovieName);

                mMediaPlayer.setDataSource(afd.getFileDescriptor(),

                    afd.getStartOffset(), afd.getLength());

                afd.close();

 

                // And uncomment this line:

                // mMediaPlayer.setDataSource("/sdcard/myMovie.m4v");

 

                mMediaPlayer.setDisplay(mHolder);

                mMediaPlayer.prepareAsync();

                mMediaPlayer.setOnPreparedListener(this);

                mMediaPlayer.setOnVideoSizeChangedListener(this);

                mMediaPlayer.setOnErrorListener(this);

                mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

 

            }

            catch (Exception e)

            {

Log in or register to post comments