Example Project - Video Player

Hi everybody,
The project you can download through the link below is meant to grant you immediate access to the new Video Player.

This affords you the possibility to see this feature in action, without having to implement things yourself. This is supposed to be an elevated starting point for your exploratory adventures in Unity’s Beta.

Project link (17 MB):
(Link removed)

In the ‘Cinema’ Scene you take place inside a virtual cinema to watch videos of your choice.

After opening the project in Unity and loading the ‘Cinema’ Scene, you have to import a video file and assign it to the VideoPlayer component attached to the ‘Screen’ GameObject.

Then simply play the scene and press the space bar to start the replay. If you want to enjoy a seamless cinema experience, I recommend building the project once you’ve set up the video.

If you don’t have any cinematic video material you want to examine, you can download the first part of the Adam demo here (34 MB):
(Link removed)

You can find more information about the Video Player here:
https://docs.google.com/document/d/128X3Wr3xWDK-XTEhwnGkK4-ndqZAezijsZgQY43q0vM/edit

And here:

Please take note that this project will be taken down once the Beta concludes.

You can use this thread to discuss the subject matter. Feedback is very welcome!

Edit: Links removed due to end of beta.

1 Like

Sounds great! :slight_smile:

Can we use this video player with 5.5.0f3?

Hi Anne,
The Video Player is a new feature in 5.6, so unfortunately not.

(sigh) :slight_smile:

It doesn’t work with android? (( I do some optimization for mobile (remove all seats and lights), and set “auto play” for video, but video don’t play on Android device. Test it on Sony Z3. In Editor it works flawless.

Hello,

I tried it with the Adam Video.

Sound is not working …
I checked everything, I’m not mutted, volume is set to 1.

Changing the playback speed stop the video too at some point…

Cheers

EDIT: Audio works with an AudioSource but not with “Direct” Mode

Has anyone succeeded in playing 4K 360 video? I’ve tried quite a couple of encodings but Unity keeps throwing errors “Error while reading movie” and “Movie encoding error”. I’ve tried H.264 (Main 5.1) and H.265. Any special settings I’m missing?

1 Like

You’ll have to disable the VideoControl script as well and change the screen Material from ScreenStart to Video. Then It should work with auto play.

Unfortunately “Direct” mode doesn’t work on Windows. I’ll look into implementing the AudioSource solution into the project.

EDIT: Updated the project to play audio via AudioSource.

@Yode_group Has now been acknowledged by Unity as reproducible bug 866587 (not working on Android)

It doesn’t help :frowning:

Thx for link. Vote for it.

Is it possible to use Video Player in WebGL? I have exported a project using WebGL but the video does not show up. It works fine in Editor.

Anybody have answer to the question if the video player works in WebGL?

Im using WebGL and need a video player, I hope you guys havnt forgotten about WebGL, we are people too!

Can it stream a mp4 video and play it, for example can i tell it to play a video located at www.mysite.com/hello.mp4

Yes, WebGL is supported. But it works only with URLs and not VideoClips.

Even when using URL the video is not showing up. It shows in Editor, but not when exported to WebGL.

I am getting this error as you can see in the image.

1 Like

maybe check your CORS, some websites maybe dont want you playing their videos from another site, i think, just trying to help.

Hi, yeah. CORS seems to be a problem. I also had problem with Microsoft IIS. I have changed my URL and put it on Apache Server. The video is working fine in WebGL now.

1 Like

I found kind of an obscure Error, using Perforce and was able to resolve it, eventually. Process to re-produce error:

Have a project working with video in a folder, and video on an object, Branch the Project, open the source, allow to re-compile, and then play / execute, it will come up with a “Can’t find movie [ ]” error. I did some looking into where that error lived, so I could see what it was trying to do, it must sin in the source, as it’s not in my code, or code I can see. So I tried everything, assigning nothing to the Video Clip, changing the render to texture, renaming things nothing worked, until I remove the movie from the project and brought it back in, re-creating the meta file I assume, and then when I dragged it in it started working, nothing materially changed, other than me removing and having to re-import the movie.

Running sample project with adam sample video on my Google Nexus 5X (Android 7.1.1). App crahes with stacktrace:

The only thing I modified is VideoControl::Update() method so it starts video automatically:

if (!videoPlayer.isPlaying) {
     videoPlayer.Play();
}

WebGLMovieTexture doesnt work on Chrome browser, gives error fastSeek is not a function, but it works in firefox.

I had the same error as you (AndroidVideoMedia::StartAudioDecoders: Cannot get media track 1 language). To make the example above work on Android, I had to uncheck the “import audio” checkbox in the import settings for the video. I was able to play three videos simultaneously on three different screens.

Note that this does not work on iOS. Although there is no crash or error messages, no video plays. I tried on iOS 10.2.1 and 8.1.1. Has anybody been able to play videos on iOS using the new VideoPlayer ?