I’m using Unity’s video player in my application and trying to adapt it to AVP. If I understand correctly, only the use of the Polyspatial Video component allows playing videos, and it works only in mixed reality. How can I control the playback and pause of a video with this component? I can’t seem to find any documentation that presents the methods that can be called with this script.
I have this error:
error CS0246: The type or namespace name ‘PolySpatialVideoComponent’ could not be found (are you missing a using directive or an assembly reference?)
The Unity.PolySpatial.PolySpatialVideoComponent class has methods Start(), Play(), Stop(), and Pause() that allow control of playback.
How are you attempting to create the component? Typically one would add an instance of it to a GameObject via the Inspector. If you’re creating it in code, you may need a “using Unity.PolySpatial;” directive at the top of the file.
I managed to integrate my video; I didn’t understand how to add the directive at first.
Is there a way to programmatically modify the Video Clip of the component currently?
I’m trying to change the value of m_Clip, but it doesn’t seem to be accessible.
public void LoadVideo(int index)
VideoPlayer.m_Clip = VideoClips[index];
Error CS1061: ‘PolySpatialVideoComponent’ does not contain a definition for ‘m_Clip,’ and no accessible extension method ‘m_Clip’ accepting a first argument of type ‘PolySpatialVideoComponent’ could be found (are you missing a using directive or an assembly reference?)
I have an animation in the form of a video that I need to play multiple times. So, I use Play() to start it and Stop() after a delay that corresponds to the duration of my video, then I call Play() again to start it a second time, and so on.
My video plays several times as expected in the Unity Editor via PolySpatialVideoComponent, as described in my code.
However, when I test in the simulator, the video only plays once and nothing is displayed after that.
PS: I also noticed that Start() doesn’t seem to work.
Ok, I’m going to try to do a repro project in the next few days.
Here are some details I can provide right now.
Initially, my Polyspatial video component was non-looping. I set it to loop for testing, and it loops correctly. However, it doesn’t seem to respond to my Stop() and then Play() calls, which I would like to use to restart the video from the beginning.
Regarding Start(), when I try to use it, I get this error:
error CS1061: ‘PolySpatialVideoComponent’ does not contain a definition for ‘Start’ and no accessible extension method ‘Start’ accepting a first argument of type ‘PolySpatialVideoComponent’ could be found (are you missing a using directive or an assembly reference?)
Sorry, I shouldn’t have listed Start along with the other methods. Start is a private method that runs on startup (just the standard MonoBehaviour.Start method). The method to use to start the video is Play (and you should be able to control whether the video plays on startup with the playOnAwake field).