CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
[CriMana] Seek playback

Description of the sample

Overview

cri4u_samples_crimana_scene05_screenshot.png

This sample performs seek playback. It uses a runtime script to play a movie from any position (frame).
Seek playback is performed from the runtime script based on the user operations (using the CriManaMovieController placed in Unity Editor).
You can start the movie at a desired position by moving the slider on the screen.

Scene information


Middleware CRI Sofdec (CRI Mana)
Sample Basic samples
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/crimana/basic/
Scene file Scene_05_Seek.unity


Description of the program


This sample program starts playing a movie from any position (i.e. based on the specified seek position).
The runtime script uses the API of the CriManaMovieController component to specify the seek position.
In this sample, the component was added beforehand in Unity Editor.

Specifying the seek position

In seek playback, the CriMana.Player::SetSeekPosition function is used to specify a frame number before starting playback.
When the movie is being played, the CriMana.Player::Stop function or the CriMana.Player::StopForSeek function requests the stop of playback. Then, the seek position is specified to start playback.


void Update() {
if (requestedSeek && movieController.player.status == CriMana.Player.Status.Stop) {
/* Seek the movie and start the playback. */
movieController.player.SetSeekPosition(seekFrameNumber);
movieController.player.Start();
requestedSeek = false;
}
}