Log in or register to post comments

What is the best way for loading videos when having many videos and patterns

June 20, 2016 - 1:49am #1

I have 85 patterns and 85 videos in my app

problems:

1: file: VideoPlaybackRenderer:

should I repeat these lines of code for every pattern:


if (target == VideoPlayback.Target100107) {
            tempUVMultRes = uvMultMat4f(
                    videoQuadTextureCoordsTransformedTarget0[0],
                    videoQuadTextureCoordsTransformedTarget0[1],
                    videoQuadTextureCoords[0], videoQuadTextureCoords[1], mtx);
            videoQuadTextureCoordsTransformedTarget0[0] = tempUVMultRes[0];
            videoQuadTextureCoordsTransformedTarget0[1] = tempUVMultRes[1];
            tempUVMultRes = uvMultMat4f(
                    videoQuadTextureCoordsTransformedTarget0[2],
                    videoQuadTextureCoordsTransformedTarget0[3],
                    videoQuadTextureCoords[2], videoQuadTextureCoords[3], mtx);
            videoQuadTextureCoordsTransformedTarget0[2] = tempUVMultRes[0];
            videoQuadTextureCoordsTransformedTarget0[3] = tempUVMultRes[1];
            tempUVMultRes = uvMultMat4f(
                    videoQuadTextureCoordsTransformedTarget0[4],
                    videoQuadTextureCoordsTransformedTarget0[5],
                    videoQuadTextureCoords[4], videoQuadTextureCoords[5], mtx);
            videoQuadTextureCoordsTransformedTarget0[4] = tempUVMultRes[0];
            videoQuadTextureCoordsTransformedTarget0[5] = tempUVMultRes[1];
            tempUVMultRes = uvMultMat4f(
                    videoQuadTextureCoordsTransformedTarget0[6],
                    videoQuadTextureCoordsTransformedTarget0[7],
                    videoQuadTextureCoords[6], videoQuadTextureCoords[7], mtx);
            videoQuadTextureCoordsTransformedTarget0[6] = tempUVMultRes[0];
            videoQuadTextureCoordsTransformedTarget0[7] = tempUVMultRes[1];
        }

2: when the pattern is recognized, the video plays upside down, I have googled for this problem but can't find a way to fix this. in my other apps this is not happening even with the same pattern and videos.

3: the major problem  is the "load" method in file : VideoPlayerHelper

I'm reading the videos from .obb file inside sdcard. (code below) as we are having 85 patterns the load method executes 85 times, so it takes a long time to process these lines of code and finally the users have to wait a long time to see the camera! here's the code inside load method:

 

ZipResourceFile expansionFile = null;


expansionFile = APKExpansionSupport.getAPKExpansionZipFile(mParentActivity.getBaseContext(), 1, 0);
AssetFileDescriptor fd = expansionFile.getAssetFileDescriptor(filename);

mMediaPlayer.setDataSource(fd.getFileDescriptor(),
        fd.getStartOffset(), fd.getLength());
fd.close();

 

these are my problems. the third problem is the most important at the moment. thanks for helping

Log in or register to post comments