Esempio n. 1
0
        private Item CreatePlayerInstance()
        {
            var item = new Item();

            var player = new PS4VideoPlayer();

            player.PerformanceLevel = PS4VideoPlayer.Performance.Default;
            //player.demuxVideoBufferSize = 2 * 1024 * 1024;	// change the demux buffer from it's 1mb default
            player.demuxVideoBufferSize       = 1024;
            player.numOutputVideoFrameBuffers = 20;                     // increasing this can stop frame stuttering
            player.videoMemoryType            = PS4VideoPlayer.MemoryType.WB_ONION;

            var lumaTex = new UnityEngine.PS4.PS4ImageStream();

            lumaTex.Create(1920, 1080, PS4ImageStream.Type.R8, 0);
            var chromaTex = new UnityEngine.PS4.PS4ImageStream();

            chromaTex.Create(1920 / 2, 1080 / 2, PS4ImageStream.Type.R8G8, 0);

            player.Init(lumaTex, chromaTex);

            item.player               = player;
            item.material             = new Material(Shader.Find("FMVTexture"));
            item.material.mainTexture = lumaTex.GetTexture();
            item.material.SetTexture("_CromaTex", chromaTex.GetTexture());

            return(item);
        }
Esempio n. 2
0
    public void StartVideo()
    {
        if (isStart)
        {
            return;
        }


#if UNITY_PS4 && !UNITY_EDITOR
        planePS4.gameObject.SetActive(true);

        videoPlayerPs4 = new PS4VideoPlayer();

        videoPlayerPs4.PerformanceLevel      = PS4VideoPlayer.Performance.Optimal;
        videoPlayerPs4.clearFrameOnTerminate = false;
        videoPlayerPs4.demuxVideoBufferSize  = 8 * 1024 * 1024;      // defaults to 256k, or 1mb for Optimal
        videoPlayerPs4.videoDecoderType      = PS4VideoPlayer.VideoDecoderType.SOFTWARE2;
        videoPlayerPs4.videoMemoryType       = PS4VideoPlayer.MemoryType.WC_GARLIC;

        //      video.AudioThreadPriority = 500;

        lumaTex = new UnityEngine.PS4.PS4ImageStream();
        lumaTex.Create(1920, 1080, PS4ImageStream.Type.R8, 0);
        chromaTex = new UnityEngine.PS4.PS4ImageStream();
        chromaTex.Create(1920 / 2, 1080 / 2, PS4ImageStream.Type.R8G8, 0);
        videoPlayerPs4.Init(lumaTex, chromaTex);

        planePS4.material.mainTexture = lumaTex.GetTexture();
        planePS4.material.SetTexture("_CromaTex", chromaTex.GetTexture());

        videoPlayerPs4.Play(MoviePath + pathHD + videoName, looping);
#else
        video.url = MoviePath + pathHD + videoName;

        video.isLooping              = false;
        video.renderMode             = UnityEngine.Video.VideoRenderMode.MaterialOverride;
        video.targetMaterialRenderer = GetComponent <Renderer>();
        video.targetMaterialProperty = "_MainTex";

        video.Play();
#endif

        if (isDebug)
        {
            StartCoroutine("FinishVideo", timeDebug);
        }
        isStart = true;
    }
Esempio n. 3
0
    //qua ci pensa il modulo PS4

    void Start()
    {
        //disabilitiamo il modulo non PS4
        video = new PS4VideoPlayer();                   // this sets up a VideoDecoderType.DEFAULT system

        bool useNewDecoder = true;

        if (useNewDecoder == false)
        {
            //	 this setting allows you to player more than one video at the same time
            video.PerformanceLevel           = PS4VideoPlayer.Performance.Default;
            video.demuxVideoBufferSize       = 2 * 1024 * 1024; // change the demux buffer from it's 1mb default
            video.numOutputVideoFrameBuffers = 3;               // increasing this can stop frame stuttering
        }
        else
        {
            video.PerformanceLevel           = PS4VideoPlayer.Performance.Optimal;
            video.demuxVideoBufferSize       = 2 * 1024 * 1024; // change the demux buffer from it's 1mb default
            video.numOutputVideoFrameBuffers = 2;               // increasing this can stop frame stuttering
        }

        lumaTex = new UnityEngine.PS4.PS4ImageStream();
        lumaTex.Create(1920, 1080, PS4ImageStream.Type.R8, 0);
        chromaTex = new UnityEngine.PS4.PS4ImageStream();
        chromaTex.Create(1920 / 2, 1080 / 2, PS4ImageStream.Type.R8G8, 0);
        video.Init(lumaTex, chromaTex);

        plane = GameObject.Find("PS4Video");
        plane.GetComponent <Renderer>().material.mainTexture = lumaTex.GetTexture();
        plane.GetComponent <Renderer>().material.SetTexture("_CromaTex", chromaTex.GetTexture());

        initialized = false;

        string assetLocation = System.IO.Path.Combine(Application.streamingAssetsPath, "VelocityImprovedLogo.mp4");

        Play(assetLocation);
    }