J'ai suivi ce tutorial qui explique comment utiliser le video player sans code:
https://www.youtube.com/watch?v=fT5fMP_F1o0
Sur le site upln il montre un code d'exemple pour charger la video depuis le script:
https://upln.fr/cinematique-lire-une-vi ... vec-unity/
Le problème c'est que avec ce code l'audiosource qui est rattaché au video player ne se lance pas quand la vidéo se lance.
Code : Tout sélectionner
using UnityEngine;
public class HTTPVideoScript : MonoBehaviour {
// Use this for initialization
void Start () {
var vPlayer = gameObject.AddComponent<UnityEngine.Video.VideoPlayer>();
vPlayer.URL = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4";
vPlayer.target = UnityEngine.Video.VideoTarget.CameraFrontPlane;
vPlayer.alpha = 0.5f;
vPlayer.prepareCompleted += Prepared;
vPlayer.Prepare();
}
void Prepared(UnityEngine.Video.VideoPlayer vPlayer) {
Debug.Log("End reached!");
vPlayer.Play();
}
}