NexPlayer Simple is a slimmed-down version of our full-featured sample player, NexPlayer Full Feat.
-
To add video playback to your scene, you will need to add a NexPlayer Simple component to your scene:
-
NexPlayer Simple supports any of the three supported render modes (RawImage, RenderTexture and Material Override). Navigate the NexPlayerRenderController component in the Inspector, select the desired Render Mode and set the reference to that Render Object:
- Set the Starting Render Mode to Raw Image:
- Create a Raw Image in your scene (GameObject → UI → Raw Image) and drag and drop it into the Raw Image field of the NexPlayerRenderController component:
- Start the scene and the video will play on the Raw Image.
- Set the Starting Render Mode to Material Override:
- Create a cube in your scene (GameObject → 3D Object → Cube) and drag and drop it into the Material Override field of the NexPlayerRenderController component:
- Set NexPlayerDefaultMaterial into the cube as material:
- Start the scene and the video will play on the cube.
-
Create a cube in your scene (GameObject → 3D Object → Cube).
-
Create or use RenderTexture in NexPlayer Project (Packages > NexPlayer SDK > NexPlayer > Materials):
-
Drag and drop it onto the same Render Texture to field of the NexPlayerRenderController component:
- Start the scene and the video will play on the cube.
NexPlayer Full Feat is our full-featured sample player.
The NexPlayer Plugin for Unity can be quickly integrated into a Unity project using the files included in the Unity Package.
After importing the Unity Package into your Unity project, you should perform the following steps:
- Create the NexPlayer GameObjects by either using the NexPlayer Context Menu at the top or by right clicking in the Hierarchy (Object Context Menu):
- "NexPlayer_Manager"
- "NexPlayer_UI"
- "NexPlayerSamplesController"
- Set "NexPlayer_Manager" references to the UI elements automatically by clicking on the button "Set UI References".
- Select any of the different samples provided by NexPlayer on the "NexPlayerSamplesController".
- Change the NexPlayer component inside NexPlayer_Manager with the required stream settings.
- Set Media Source Values (PlayMode, Url, isLiveStream, HTTP Headers and DRM).
- Set Media Output Section Values (RenderMode and Rendering)
- Set the Playback Properties (Autoplay, Loop…).
To display a video in your own RenderTexture object, remember to add a Material to the object that contains the same texture as you referenced in the player. Standard materials can be found in Packages > NexPlayer SDK > NexPlayer > Materials.
It's recommended to refer to section Build Configuration, of the desired platform, before building the project.
The NexPlayer Plugin for Unity provides different samples that can be created on a blank scene through Unity's Context Menus. Once created, it offers 10 different use cases that can be easily chosen in the NexPlayerSamplesController component in the Inspector.
- RawImage_Sample: Video player using a Raw Image component to display the video through a raw image component.
- RenderTexture_Sample: Video player using a Render Texture component to display the video through a static cube.
- Transparency: Video player using a Render Texture component to display the video through a plane and convert a color from the video to transparent.
- VideoSpread_Sample: Video player using a Render Texture component to display the video across multiple objects.
- MaterialOverride_Sample: Video player using a Material Override component to display the video through a rotating cube.
- MultipleRenderers_Sample: Video player using different objects that share the Material renderer to display the same video multiple times.
- ChangeRenderMode_Sample: Video player that changes the render mode to display a video in all the supported renderers. Displays one render mode at the same time.
- 360_Sample: Video player using a Material Override component in a sphere to display the video in 360º.
- Multistream_RawImage_Sample: Video player using different links and Raw Images to play multiple videos at the same time. Not supported on Windows, UWP platforms & Nintendo.
- Multistream_RenderTexture_Sample: Video player using different links and Render Textures to play multiple videos at the same time. Not supported on Windows, UWP platforms & Nintendo.
In order to start using the NexPlayer Plugin for Unity SDK, it's good to have an understanding of the basic flow that the player needs to follow in order to function properly.