PlayFullScreenMovie black background :(

I have a scene with a camera and white background and a gameobject to play a movie using:

Handheld.PlayFullScreenMovie(videoPath, Color.white, FullScreenMovieControlMode.CancelOnInput);

(ive also tried without camera)

However the screen is black, the white movie then slides into view and at the end it slides out exposing the black :frowning:

On Twitter it was suggested that its the iOS viewController.

Search results so far:

“Black screen for a short while when playing fullscreen movie”
http://forum.unity3d.com/threads/206431-Black-screen-for-a-short-while-when-playing-fullscreen-movie

from 2011
http://forum.unity3d.com/threads/85739-Video-on-iOS-fullscreen-yes-but

Stop sliding transition animation when playing a movie with iOS

response from 2011:

“Ok, At the moment this hasn’t been changed/exposed from the Apple default movieTexture player. i.e. [moviePlayer setFullscreen:YES animated:YES] isn’t actually called any where. It might be possible for you to set non-animated via a custom plugin… Otherwise atm there is nothing out of the box to enable/disable this…”

Hmm.

One of the selling points of Unity Pro is the ability to play video, but there is no mention of this issue in the licence comparison:

2 Video playback can only occur fullscreen on iOS and Android devices, playback as a texture on a surface is not supported.

Here
http://docs.unity3d.com/Documentation/Manual/VideoFiles.html

it says:
“As soon as you call Handheld.PlayFullScreenMovie the screen will fade from your current content to the designated background color. It might take some time before the movie is ready to play but in the meantime, the player will continue displaying the background color and may also display a progress indicator to let the user know the movie is loading. When playback finishes, the screen will fade back to your content.”

This from what I can see isn’t what happens on iOS.

Either I’m doing it wrong or something else is wrong :slight_smile:

Any thoughts?

Thanks
Chris

Perhaps some more information will help…

void Start () {
   PlayVideo("mine.mp4");
}

void PlayVideo(string videoPath){
  StartCoroutine(PlayVideoCoroutine(videoPath));
}
	
protected IEnumerator PlayVideoCoroutine(string videoPath){

	Handheld.PlayFullScreenMovie(videoPath, Color.white, FullScreenMovieControlMode.CancelOnInput); 
	yield return new WaitForEndOfFrame();
		
	Application.LoadLevel("newLevel"); 
}

so playmovie is called from start, I took it out of start and put into update…

if (Input.GetMouseButtonUp (0)) {
  PlayVideo("mine.mp4");
}

Guess what, no black background when you press down. Is it because there is a delay between the scene starting and calling playvideo? i tried:

if (Time.timeSinceLevelLoad > 1.0f) {
	if (!startedVideo) {
		PlayVideo (videoFile);
		startedVideo=true;
	}
}

and no black background. Any ideas from iOS devs as to why this is would be great, thanks!

Please submit a bugreport.
Thanks!

You play the movie, wait 1 frame, then you immediately load a different level, instead of using Async loading like so:

loadOp = Application.LoadLevelAsync(“newLevel”);
loadOp.allowSceneActivation = true;

So no, that wouldn’t work.

Video playback can only occur fullscreen on iOS and Android devices, playback as a texture on a surface is not supported.

thats not exactly true for ios

https://bitbucket.org/Unity-Technologies/iosnativecodesamples/src/2c85a37958dc008c861ba6d49b26d9c8e8fa790c/NativeIntegration/Video/VideoPlayerTexture?at=4.5-stable

https://bitbucket.org/Unity-Technologies/iosnativecodesamples/src/2c85a37958dc008c861ba6d49b26d9c8e8fa790c/NativeIntegration/Video/VideoPlayer?at=4.5-stable

The first project (VideoPlayerTexture) crashes before launching

#1 0x0000000100815a24 in AddCreatedTexture at /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/metal/TexturesMetal.mm:172
#2 0x00000001004e41fc in ::InitTexture() at /Users/builduser/buildslave/unity/build/Runtime/Graphics/Texture2D.cpp:472
#3 0x00000001008081a8 in ::Texture2D_CUSTOM_Internal_Create() at /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cpp:213
#4 0x00000001001385c0 in ::Texture2D_CreateExternalTexture_m30(Object_t , int32_t, int32_t, int32_t, bool, bool, IntPtr_t, const MethodInfo ) at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/il2cpp_output/Bulk_UnityEngine_0.cpp:3548
#5 0x000000010005bc20 in ::VideoPlayerInterface_get_videoTexture_m18(VideoPlayerInterface_t6 , const MethodInfo ) at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/il2cpp_output/Bulk_Assembly-CSharp_0.cpp:488
#6 0x000000010005bab8 in ::TestVideo_Update_m4(TestVideo_t4 , const MethodInfo ) at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/il2cpp_output/Bulk_Assembly-CSharp_0.cpp:147
#7 0x000000010032c014 in RuntimeInvoker_Void_t779(MethodInfo const
, void
, void
) at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/il2cpp_output/Il2CppInvokerTable.cpp:281
#8 0x0000000100c6605c in il2cpp::vm::Runtime::Invoke(MethodInfo const
, void
, void**, Il2CppObject**) ()
#9 0x00000001005851e0 in ::Invoke() at /Users/builduser/buildslave/unity/build/Runtime/Scripting/Backend/ScriptingInvocationNoArgs.cpp:103
#10 0x0000000100585194 in ::Invoke() at /Users/builduser/buildslave/unity/build/Runtime/Scripting/Backend/ScriptingInvocationNoArgs.cpp:87
#11 0x000000010057f1fc in CallMethodIfAvailable [inlined] at /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp:523
#12 0x000000010057f1b0 in ::CallUpdateMethod() at /Users/builduser/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp:607
#13 0x000000010049a5ec in UpdateBehaviour [inlined] at /Users/builduser/buildslave/unity/build/Runtime/GameCode/Behaviour.cpp:169
#14 0x000000010049a5e0 in ::CommonUpdate() at /Users/builduser/buildslave/unity/build/Runtime/GameCode/Behaviour.cpp:148
#15 0x00000001005352e4 in ::PlayerLoop() at /Users/builduser/buildslave/unity/build/Runtime/Misc/Player.cpp:1863
#16 0x0000000100348160 in UnityPlayerLoopImpl at /Users/builduser/buildslave/unity/build/PlatformDependent/iPhonePlayer/LibEntryPoint.mm:237
#17 0x0000000100048bd4 in UnityRepaint at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/Classes/UnityAppController+Rendering.mm:246
#18 0x0000000100048a50 in __51-[UnityAppController(Rendering) repaintDisplayLink]_block_invoke at /Users/rafaelmarteleto/projects/sandbox/VideoPlayerTexture/ios/Classes/UnityAppController+Rendering.mm:52

The second project (VideoPlayer) doesn’t compile:

Undefined symbols for architecture arm64:

“_kUnityViewDidRotate”, referenced from:

_VideoPlayer_PlayVideo in VideoPlayerInterface.o

Is there any chance we see Handheld.PlayFullScreenMovie ever working properly? Unity’s implementation on MPMoviePlayerController seems to be lacking some revision.

that tells me you use some “other” unity version
if you check the site you will see branch dropdown saying “4.5-stable”, if you use 5.x please use 5 branch

ok, it was brought to my attention that my updates to this project were NOT merged to mainline, so yeah, please pull/download now :wink: