Unity - VideoPlayer

비디오가 가끔 작동을 안하는 오류가 있음.
RawImage는 파일이 크면 작동이 안하는 이슈가 있음.(안찾아봄)


Manager


Use Plane(방법1)


Use RawImage(방법2)


Play




script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
 
public class Plane_VideoPlayer : MonoBehaviour {
    
    public Text current_time;
    public Text max_time;
    public Text Frame;
 
    public VideoPlayer vp;
    public VideoClip videoClip;
    
    void Update()
    {
        current_time.text = "현재시간" + vp.time;
 
        max_time.text = "영상시간" + vp.clip.length;
 
        Frame.text = "영상프레임" + vp.frameRate;
 
        print(vp.isPlaying);
 
        //Debug.Log("vp.isPlaying : " + vp.isPlaying);
        //Debug.Log("vp.isPrepared : " + vp.isPrepared);
        //Debug.Log("vp.isLooping : " + vp.isLooping);
    }
 
    // playButton
    public void Play()
    {
        //vp.clip = videoClip; // 방법1 클립
        vp.url = "C:\\Test\\test.mp4"// 방법2 경로
        vp.Play();
    }
 
    // pauseButton
    public void pause()
    {
        vp.Pause();
    }
 
    // stopButton
    public void Stop()
    {
        vp.Stop();
    }
}
cs

댓글