Example #1
0
 private void OnOpenVideoFile(string Videopath)
 {
     TriggerTime_C = 0;
     _mediaPlayer.m_VideoPath = string.Empty;
     _mediaPlayer.m_VideoPath =Videopath;
     if (string.IsNullOrEmpty(_mediaPlayer.m_VideoPath))
     {
         _mediaPlayer.CloseVideo();
     }
     else
     {
         _mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, _mediaPlayer.m_VideoPath);
         _mediaPlayer.Control.Pause();
     }
 }
Example #2
0
        public void OnOpenVideoFile()
        {
            _mediaPlayer.m_VideoPath = System.IO.Path.Combine(_folder, _videoFiles[_VideoIndex]);
            _VideoIndex = (_VideoIndex + 1) % (_videoFiles.Length);
            if (string.IsNullOrEmpty(_mediaPlayer.m_VideoPath))
            {
                _mediaPlayer.CloseVideo();
                _VideoIndex = 0;
            }
            else
            {
                _mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, _mediaPlayer.m_VideoPath, _AutoStartToggle.isOn);
//				SetButtonEnabled( "PlayButton", !_mediaPlayer.m_AutoStart );
//				SetButtonEnabled( "PauseButton", _mediaPlayer.m_AutoStart );
            }
        }
Example #3
0
        public void Dispose()
        {
            MediaPlayer.CloseVideo();

            MediaPlayer     = null;
            DisplayUGUI     = null;
            FinishedPlaying = null;
            m_GGraph.Dispose();
        }
Example #4
0
 public void RestData()
 {
     nDBWarID        = 0;
     m_SeekValue     = 0;
     bPlayingOnScrub = false;
     if (Player != null)
     {
         Player.CloseVideo();
     }
 }
 public static void StopMovieShow(GameObject obj)
 {
     if (obj != null)
     {
         MediaPlayer mediaPlayer = obj.GetComponent <MediaPlayer>();
         if (mediaPlayer)
         {
             mediaPlayer.CloseVideo();
         }
     }
 }
        private void Start()
        {
            if (_mp != null)
            {
                int        chunkSize = 512;
                byte[]     chunk     = new byte[chunkSize];
                FileStream fs        = File.OpenRead(_filename);
                long       fileSize  = fs.Length;
                if (!_mp.StartOpenChunkedVideoFromBuffer((ulong)fileSize))
                {
                    _mp.CloseVideo();
                }

                ulong currOffset = 0;
                while (true)
                {
                    int bytesRead = fs.Read(chunk, 0, chunkSize);
                    if (bytesRead > 0)
                    {
                        if (!_mp.AddChunkToVideoBuffer(chunk, currOffset, (ulong)bytesRead))
                        {
                            _mp.CloseVideo();
                        }
                    }
                    else
                    {
                        break;
                    }

                    currOffset += (ulong)bytesRead;
                }

                if (!_mp.EndOpenChunkedVideoFromBuffer())
                {
                    _mp.CloseVideo();
                }
            }

            System.GC.Collect();
        }
Example #7
0
 public void Clean()
 {
     _state = PlayerState.None;
     if (Player != null)
     {
         Player.CloseVideo();
     }
     if (_afterImageRt != null)
     {
         RenderTexture.ReleaseTemporary(_afterImageRt);
         _afterImageRt = null;
     }
 }
Example #8
0
 public void LoadNextVideo()
 {
     if (L == Videos.Count - 1)
     {
         L = 0;
     }
     if (Player.VideoOpened)
     {
         Player.CloseVideo();
     }
     Txt.text = Videos[L];
     Player.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, "TestVids/" + Videos[L] + ".mp4");
     L++;
 }
        public void Quit()
        {
            MediaPlayer component = GetComponent <MediaPlayer>();

            if (component != null)
            {
                component.CloseVideo();
            }
            if (Renderer != null)
            {
                Renderer.enabled = false;
            }
            base.enabled = false;
        }
Example #10
0
 public static void ChangeVideo(MediaPlayer media)
 {
     _Paths            = ReadExternalFilesTools.FindAllFiles(Application.streamingAssetsPath, ".mp4");
     media.m_VideoPath = _Paths[_VideoIndex];
     _VideoIndex       = (_VideoIndex + 1) % (_Paths.Count);
     if (string.IsNullOrEmpty(media.m_VideoPath))
     {
         media.CloseVideo();
         _VideoIndex = 0;
     }
     else
     {
         media.OpenVideoFromFile(_location, media.m_VideoPath, true);
     }
 }
Example #11
0
 public override void EndScene()
 {
     if (perspectiveColliders != null)
     {
         perspectiveColliders.SetActive(false);
     }
     if (dannyCollider != null)
     {
         dannyCollider.enabled = false;
     }
     mediaPlayer.Pause();
     videoSphere.SetActive(false);
     moodSlider.SetActive(false);
     mediaPlayer.CloseVideo();
 }
Example #12
0
    private IEnumerator stopVideo()
    {
        if (isOpen)
        {
            mediaPlayer.Stop();

            yield return(new WaitForSeconds(1f));

            mediaPlayer.CloseVideo();

            isOpen = false;

            //Debug.Log("关闭视频");
        }
    }
Example #13
0
    void MpEvents(MediaPlayer meida, MediaPlayerEvent.EventType eventType, ErrorCode code)
    {
        switch (eventType)
        {
        case MediaPlayerEvent.EventType.FinishedPlaying:
            if (!mp.Control.IsLooping())
            {
                Debug.Log("返回默认");
                mp.CloseVideo();
                //mp.m_VideoPath = "";
            }
            break;

        case MediaPlayerEvent.EventType.FirstFrameReady:
            mp.Control.SetLooping(Config._instance.GetLoop());
            Debug.Log(mp.Control.IsLooping());
            break;
        }
    }
 /// <summary>
 /// 初始化
 /// </summary>
 private void initState()
 {
     TipsUpdate.Instance.UpdateTipsText("");
     chechuangModel.gameObject.SetActive(false);
     //Camera.main.GetComponent<CamRot>().mode = null;
     chechuangImage.gameObject.SetActive(false);
     useRangeBtnPanel.SetActive(false);
     rightPanel.SetActive(false);
     chedaoMenu.SetActive(false);
     videoPlayer.SetActive(false);
     chedaoModel.SetActive(false);
     chedaojiegouPanel.SetActive(false);
     chechuangfujianPanel.SetActive(false);
     sanzhuakapanModel.SetActive(false);
     gendaojiaModel.SetActive(false);
     zhongxinjiaModel.SetActive(false);
     sanzhuakapanPanel.SetActive(false);
     sanzhuakaPanyuanliModel.SetActive(false);
     mp.CloseVideo();
 }
Example #15
0
 public static void ChangeVideo(MediaPlayer media, string name, bool isOn)
 {
     _Paths = ReadExternalFilesTools.FindAllFiles(Application.streamingAssetsPath, ".mp4");
     for (int i = 0; i < _Paths.Count; i++)
     {
         if (_Paths[i].Split('\\')[_Paths[i].Split('\\').Length - 1].Replace(".mp4", "").Equals(name))
         {
             media.m_VideoPath = _Paths[i];
             if (string.IsNullOrEmpty(media.m_VideoPath))
             {
                 media.CloseVideo();
                 _VideoIndex = 0;
             }
             else
             {
                 Debug.Log(_Paths[i]);
                 media.OpenVideoFromFile(_location, media.m_VideoPath, isOn);
             }
         }
     }
 }
    public override void StopVideo()
    {
        medialPlayer.Stop();

        medialPlayer.CloseVideo();
    }
Example #17
0
 public void closeVideo()
 {
     mMediaPlayer.CloseVideo();
 }
Example #18
0
 public void Stop()
 {
     playcotorl.CloseVideo();
 }
Example #19
0
 /// <summary>
 /// Stop music.
 /// </summary>
 public void StopBGM()
 {
     _mediaPlayer.CloseVideo();
 }
Example #20
0
 public void unLoadVideo(MediaPlayer mediaPlayer)
 {
     mediaPlayer.CloseVideo();
 }