Log in or register to post comments

Packaging a video plane in an assetbundle

August 28, 2013 - 12:28pm #15

I am loading augmentations dynamically from a remote server, and am getting a crash when I try to load any assetbundles that have a video plane contained in them.  I need both of these functionalities.  I am assuming the problem is with initialization, but I don't get any errors when testing in play mode.

Packaging a video plane in an assetbundle

August 28, 2013 - 3:24pm #14

Scripts can't be packaged w/ Unity AssetBundles and only Unity asset types can be bundled, which prevents the inclusion of video files. If you want to deliver video to the device file system, you'll need to download it as a file and load it w/ an existing Video prefab instance.

Packaging a video plane in an assetbundle

August 28, 2013 - 4:07pm #13

The goal is to stream the video in, which will necessitate saving it to the device, but scripts can be included as long as they are compiled along with the project.  When using play mode, the video and the rest of the augmentation appears, but on the device nothing appears.  Also, in play mode, clicking on the plane has no result.  So my current issue appears to be twofold.  One, something is preventing proper initialization on mobile, and two, even when it is instantiated, it does not integrate properly and accept input.

Packaging a video plane in an assetbundle

August 29, 2013 - 12:22am #12

If it works in PlayMode but not on device, this may be due to the way the asset bundle has been created (exported);

if you are targeting a mobile platform (Android or iOS), you usually need to specify the build target, as explained here:

http://docs.unity3d.com/Documentation/ScriptReference/BuildPipeline.BuildAssetBundle.html

http://docs.unity3d.com/Documentation/ScriptReference/BuildTarget.html

For instance, you may need to use BuildTarget.Android.

Packaging a video plane in an assetbundle

August 29, 2013 - 11:12am #11

The asset bundle is properly built for android.  The augmentation appears if the video playback script is disabled, but either crashes or does not appear when it is enabled.  I did realize the asset was missing a playback handler.  I will report back if that fixes the issue.

 

Edit:  It did not, still crashing.  The DDMS debugger is throwing me a lot of errors that state failed to receive dispatch signal, and when it crashes, it reports 

08-29 11:09:55.210: E/Unity(12755): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)

 

I am new to using the debugger, so I am unclear on how to use this information.

Packaging a video plane in an assetbundle

August 29, 2013 - 11:51am #10

Hard to tell from the error log;

but as David previously said, there are certain limitations to include scripts in assetBundles;

the video playback script relies on some underlying implementation in Java and made available to Unity through JNI; I suspect that this may not be fully compatible (at least on mobile) with the ability to package it into the assetBundle.

Have you tried asking on the Unity website on this subject? they may have extra tips to suggest... this sounds quite an advanced use of assetbundles

 

Packaging a video plane in an assetbundle

August 29, 2013 - 6:14pm #9

When running the app as a Development build, it succesfully instantiates the bundle and controls, but the video will not play, whether it is a remote URL for streaming or it is a file that is already contained in the build in the streaming assets folder. 

The debugger starts spitting out 

08-29 14:23:00.785: W/System.err(28981): at com.qualcomm.QCARUnityPlayer.QCARUnityPlayer.onDrawFrame(QCARUnityPlayer.java:67)
 
at roughly the framerate of the device until the program is closed.  I am assuming this is related to the crashing, and also the reason the video isn't playing, but as I said before I am unable to read any more into what the problem is.

Still crashes outside of Dev build.

 

In the build that the Assetbundle comes from, instantiating the prefab directly in front of the AR camera works outside of Dev build, but still doesn't play the video assigned to it.  My phone is Android 2.3 so it jumps to a black fullscreen then immediately returns to the scene.

Something has gone wrong with the way the program is managed in my phone.  It isn't being completely destroyed on Application.Quit(), and this is resulting in scripts becoming disabled when they shouldn't be, and Start() methods only being called once.

Packaging a video plane in an assetbundle

August 30, 2013 - 12:16pm #8

The problem, at least immediately, occurs in the call to SetFilename().

In this segment of code I made to test, it succeeds until it reaches SetFilename(), which fails.

StartCoroutine(Save());
mVideoPlayer = new VideoPlayerHelper();
downloaded = (mVideoPlayer != null);
mVideoPlayer.SetFilename("sdcard/test1.mp4");
m_path = mVideoPlayer.mFilename;

This results in m_Path not getting changed, which means the rest of the start function doesn't execute either.  If the issue does lie with the java methods, it would occur in SetActivity() within SetFilename().  I am unclear why this error is occuring however, because the scripts being executed are the methods compiled within the project itself, so the references to them should work as if they were native.

 

 

Packaging a video plane in an assetbundle

September 3, 2013 - 1:17pm #7

The error disappeared when using a different project.  It appears that the project I was using was not properly compiling VideoPlayerHelper, as the debug log kept outputting that it was not found.

Packaging a video plane in an assetbundle

September 3, 2013 - 11:46pm #6

Glad to hear it is solved.

Packaging a video plane in an assetbundle

September 5, 2013 - 2:25am #5

Hello,

I am trying to do nearly the exact same thing as you did CassS. Can you explain a little bit how you managed to do the whole thing?

Did you put the videos in the AssetBundles or do you load them from somewhere else outside the AssetBundle? And how can you set

the video to the Video prefab?

 

thanks in Advance

Packaging a video plane in an assetbundle

September 5, 2013 - 2:46am #4

If you don't run into the odd error that I did, you can just set the video and icons when you pack the assetbundle.  The icons will be stored in the bundle, and it will access whatever path you give it for the video.  You can't directly package the video in the assetbundle, so you'll need to set up an additional download method for the video, or rewrite the videoplayer handlers to download it and then load it in.

Packaging a video plane in an assetbundle

September 5, 2013 - 2:53am #3

Thanks for the quick response, but there is still somethin i dont get:

When you are building the AssetBundle you have the Prefab of the Video and you set the Path in the VideoPlayBackBehaviour Script?

Because that would mean the Script loads the Video from the StreamingAssets, right? Also: do you download the Video before you are

instantiating the prefab from the AssetBundle?

Packaging a video plane in an assetbundle

September 5, 2013 - 4:23am #2

The simple answer is yes, the video loads from streamingassets.  It loads from whatever path you give it, so you can have it load from a folder, or from a URL.  Streaming directly from a URL is a bad idea as it is not compatible with some devices, and in my experience, doesn't work too well on the ones it works on.  I can think of two ways to get a video remotely.  One would be to initiate the download at the same time as the assetbundle begins downloading, which would take a little more work to properly integrate with the instantiation, or modify the videoplayer scripts so that instead of just loading the result of a path, they download it if it doesn't exist, then call the load method of the video.  This would allow you to throw in things like a progress bar without too much fuss.

Packaging a video plane in an assetbundle

August 25, 2020 - 7:20am #1

Hello, Actually I was trying to pack video and video plane both in asset bundle. So when I tried to play it on the unity game screen, it works well but in the phone only plane is displaying not the video is playing. Can someone tell me what I am doing wrong please!! 

Log in or register to post comments