Ejemplo n.º 1
0
	public void Pause()
	{
		if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
			Call_Pause();
		
		m_CurrentState = MEDIAPLAYER_STATE.PAUSED;
	}
Ejemplo n.º 2
0
	public void Stop()
	{
		if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
			Call_Pause();
		
		
		m_bStop = true;
		m_CurrentState = MEDIAPLAYER_STATE.STOPPED;
		m_iCurrentSeekPosition = 0;
	}
Ejemplo n.º 3
0
    public void UnLoad()
    {
        m_bCheckFBO = false;
                #if UNITY_ANDROID
        //Call_Reset();
                #endif
        Call_UnLoad();

        m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
    }
Ejemplo n.º 4
0
    public void Stop()
    {
        //SeekTo (0); // DIGL - at export this isn't working as it looks like it should.
        if (m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
        {
            Call_Pause();
        }


        m_bStop                = true;
        m_CurrentState         = MEDIAPLAYER_STATE.STOPPED;
        m_iCurrentSeekPosition = 0;
    }
Ejemplo n.º 5
0
    public void Load(string strFileName)
    {
        m_bCheckFBO = false;

        m_strFileName = strFileName;

        if (m_bInit == false)
        {
            return;
        }

                #if UNITY_ANDROID
        //Call_Reset();
                #endif


                #if UNITY_IPHONE
        /*if (strFileName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
         * {
         *      StartCoroutine(DownloadStreamingVideoAndLoad(m_strFileName));
         * }
         * else*/
        {
            Call_Load(m_strFileName, 0);
        }
                #endif

                #if UNITY_ANDROID
        if (m_bSupportRockchip)
        {
            Call_SetRockchip(m_bSupportRockchip);

            if (strFileName.Contains("://"))
            {
                Call_Load(strFileName, 0);
            }
            else
            {
                StartCoroutine(CopyStreamingAssetVideoAndLoad(strFileName));
            }
        }
        else
        {
            Call_Load(strFileName, 0);
        }
                #endif


        m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
    }
Ejemplo n.º 6
0
        public MEDIAPLAYER_STATE GetCurrentState()
        {
            MEDIAPLAYER_STATE currentState = MEDIAPLAYER_STATE.NOT_READY;

            if (mSilverPlayer)
            {
                currentState = mSilverPlayer.GetCurrentState();
            }
            else if (mediaPlayer)
            {
                currentState = mediaPlayer.GetCurrentState();
            }
            return(currentState);
        }
Ejemplo n.º 7
0
	public void Load(string strFileName)
	{
		if( GetCurrentState() != MEDIAPLAYER_STATE.NOT_READY)
			UnLoad();


		m_bFirst = false;
		m_bCheckFBO = false;
		
		m_strFileName = strFileName;

		if( m_bInit == false)
			return;
		
		
		m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
	}
    private void Call_Play(int iSeek)
    {
        float fSeek = (float)iSeek / 1000.0f;

        if (isPlaying == true)
        {
            VideoPlayerPluginSeekToVideo(m_iID, fSeek);
        }
        else
        {
            VideoPlayerPluginSeekToVideo(m_iID, fSeek);
            VideoPlayerPluginPlayVideo(m_iID);
        }


        if (m_CurrentState == MEDIAPLAYER_STATE.STOPPED)
        {
            m_CurrentState = MEDIAPLAYER_STATE.PLAYING;
        }
    }
Ejemplo n.º 9
0
 public void UnLoad()
 {
     m_bCheckFBO = false;
     Call_UnLoad();
     m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
 }
Ejemplo n.º 10
0
    public void UnLoad()
    {
        m_bCheckFBO = false;
        #if UNITY_ANDROID

        //Call_Reset();
        #endif
        Call_UnLoad();

        m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
    }
Ejemplo n.º 11
0
    public void Pause()
    {
        if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
            Call_Pause();

        m_CurrentState = MEDIAPLAYER_STATE.PAUSED;
    }
Ejemplo n.º 12
0
 private void Call_Pause()
 {
     m_CurrentState = MEDIAPLAYER_STATE.PAUSED;
     VideoPlayerPluginPauseVideo(m_iID);
 }
Ejemplo n.º 13
0
    private void Call_Play(int iSeek)
    {
        float fSeek = (float)iSeek / 1000.0f;

        if( isPlaying == true )
        {
            VideoPlayerPluginSeekToVideo(m_iID,fSeek);
        }
        else
        {
            if( m_CurrentState != MEDIAPLAYER_STATE.READY)
                VideoPlayerPluginSeekToVideo(m_iID,fSeek);

            VideoPlayerPluginPlayVideo(m_iID);
        }

        if( m_CurrentState == MEDIAPLAYER_STATE.STOPPED)
            m_CurrentState = MEDIAPLAYER_STATE.PLAYING;
    }
Ejemplo n.º 14
0
    void Update()
    {
        if (string.IsNullOrEmpty(m_strFileName))
        {
            return;
        }

        if (checkNewActions)
        {
            checkNewActions = false;
            CheckThreading();
        }

        if (m_bFirst == false)
        {
            string strName = m_strFileName.Trim();
            // onStart();

                        #if UNITY_IPHONE || UNITY_TVOS || UNITY_ANDROID
            if (strName.StartsWith("http", StringComparison.OrdinalIgnoreCase))
            {
                Debug.Log("oiem");
                StartCoroutine(DownloadStreamingVideoAndLoad(strName));
            }
            else
            {
                Call_Load(strName, 0);
            }

            // #elif UNITY_ANDROID

            // if (m_bSupportRockchip)
            // {
            //  Call_SetRockchip(m_bSupportRockchip);

            //  if (strName.Contains("://"))
            //  {
            //      Call_Load(strName,0);
            //  }
            //  else
            //  {
            //      //Call_Load(strName,0);
            //      StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
            //  }

            // }
            // else
            // {
            //  Call_Load(strName,0);
            // }
                        #elif UNITY_STANDALONE
            // if (strName.StartsWith("http", StringComparison.OrdinalIgnoreCase))
            // {
            //  Debug.Log("oiem");
            //  StartCoroutine(DownloadStreamingVideoAndLoad(strName));
            // } else
            // {
            Call_Load(strName, 0);
            // }
                        #endif

            Call_SetLooping(m_bLoop);
            m_bFirst = true;
        }

        if (m_CurrentState == MEDIAPLAYER_STATE.PLAYING || m_CurrentState == MEDIAPLAYER_STATE.PAUSED)
        {
            if (m_bCheckFBO == false)
            {
                if (Call_GetVideoWidth() <= 0 || Call_GetVideoHeight() <= 0)
                {
                    return;
                }

                m_iWidth  = Call_GetVideoWidth();
                m_iHeight = Call_GetVideoHeight();

                Resize();

                if (m_VideoTexture != null)
                {
                    //Destroy(m_VideoTexture);

                    if (m_VideoTextureDummy != null)
                    {
                        Destroy(m_VideoTextureDummy);
                        m_VideoTextureDummy = null;
                    }

                    m_VideoTextureDummy = m_VideoTexture;
                    m_VideoTexture      = null;
                }

                                #if UNITY_ANDROID || UNITY_EDITOR || UNITY_STANDALONE
                if (m_bSupportRockchip)
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(), Call_GetVideoHeight(), TextureFormat.RGB565, false);
                }
                else
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(), Call_GetVideoHeight(), TextureFormat.RGBA32, false);
                }

                m_VideoTexture.filterMode = FilterMode.Bilinear;
                m_VideoTexture.wrapMode   = TextureWrapMode.Clamp;

                m_texPtr = m_VideoTexture.GetNativeTexturePtr();

                                #if UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5
                Call_SetUnityTexture((int)m_VideoTexture.GetNativeTexturePtr());
                                #else
                Call_SetUnityTexture(m_VideoTexture.GetNativeTextureID());
                                #endif
                                #endif
                Call_SetWindowSize();
                m_bCheckFBO = true;
                if (OnResize != null)
                {
                    OnResize();
                }
            }
            else
            {
                if (Call_GetVideoWidth() != m_iWidth || Call_GetVideoHeight() != m_iHeight)
                {
                    m_iWidth  = Call_GetVideoWidth();
                    m_iHeight = Call_GetVideoHeight();

                    ResizeTexture();
                }
            }

            Call_UpdateVideoTexture();

            m_iCurrentSeekPosition = Call_GetSeekPosition();
        }

        if (m_CurrentState != Call_GetStatus())
        {
            m_CurrentState = Call_GetStatus();

            if (m_CurrentState == MEDIAPLAYER_STATE.READY)
            {
                if (OnReady != null)
                {
                    OnReady();
                }

                if (m_bAutoPlay)
                {
                    Call_Play(0);
                }

                SetVolume(m_fVolume);
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.END)
            {
                if (OnEnd != null)
                {
                    OnEnd();
                }

                if (m_bLoop == true)
                {
                    Call_Play(0);
                }
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.ERROR)
            {
                OnError((MEDIAPLAYER_ERROR)Call_GetError(), (MEDIAPLAYER_ERROR)Call_GetErrorExtra());
            }
        }

        GL.InvalidateState();
    }
Ejemplo n.º 15
0
    void Update()
    {
        if (m_bFirst == false)
        {
            Debug.Log("MEDIAPLAYER BFIRST");

            Call_SetUnityTexture(m_VideoTexture.GetNativeTextureID());


            string strName = m_strFileName.Trim();

#if UNITY_IPHONE
            if (strName.StartsWith("http", StringComparison.OrdinalIgnoreCase))
            {
                StartCoroutine(DownloadStreamingVideoAndLoad(strName));
            }
            else
            {
                Call_Load(strName, 0);
            }
#endif
#if UNITY_ANDROID
            if (m_bSupportRockchip)
            {
                Call_SetRockchip(m_bSupportRockchip);

                if (strName.Contains("://"))
                {
                    Call_Load(strName, 0);
                }
                else
                {
                    StartCoroutine(CopyStreamingAssetVideoAndLoad(strName));
                }
            }
            else
            {
                Call_Load(strName, 0);
            }
#endif
            Call_SetLooping(m_bLoop);
            m_bFirst = true;
        }


        if (m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
        {
            if (m_bCheckFBO == false)
            {
                if (Call_GetVideoWidth() <= 0 || Call_GetVideoHeight() <= 0)
                {
                    return;
                }

                Resize();
            }

            if (m_bCheckFBO == false)
            {
                Call_SetWindowSize();
                m_bCheckFBO = true;
            }



            Call_UpdateVideoTexture();

            m_iCurrentSeekPosition = Call_GetSeekPosition();
            Debug.Log("MEDIAPLAYER SEEKPOS " + Call_GetSeekPosition().ToString());
        }



        if (m_CurrentState != Call_GetStatus())
        {
            Debug.Log("MEDIAPLAYER IS " + Call_GetStatus().ToString());

            m_CurrentState = Call_GetStatus();



            if (m_CurrentState == MEDIAPLAYER_STATE.READY)
            {
                if (m_bAutoPlay)
                {
                    Call_Play(0);
                }
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.END)
            {
                if (m_bLoop == true)
                {
                    Call_Play(0);
                }
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.ERROR)
            {
                Debug.Log("MEDIAPLAYER IS ERROR " + Call_GetError() + "," + Call_GetErrorExtra());

                OnError((MEDIAPLAYER_ERROR)Call_GetError(), (MEDIAPLAYER_ERROR)Call_GetErrorExtra());
            }
        }
    }
Ejemplo n.º 16
0
	public void Load(string strFileName)
	{
		if( GetCurrentState() != MEDIAPLAYER_STATE.NOT_READY)
			UnLoad();


		m_bIsFirstFrameReady = false;

		m_bFirst = false;
		m_bCheckFBO = false;
		
		m_strFileName = strFileName;

		if( m_bInit == false)
			return;
		
		
		m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
	}
Ejemplo n.º 17
0
    void Update()
    {
        if (string.IsNullOrEmpty(m_strFileName))
        {
            return;
        }


        if (m_bFirst == false)
        {
            string strName = m_strFileName.Trim();

                        #if UNITY_IPHONE || UNITY_TVOS
            /*if (strName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
             * {
             *      StartCoroutine( DownloadStreamingVideoAndLoad(strName) );
             * }
             * else*/
            {
                Call_Load(strName, 0);
            }
                        #endif
                        #if UNITY_ANDROID
            int    num     = LectureChooser.lectureNum;
            string sd_path = "http://cdn.cs50.net/2016/fall/lectures/" + num + "/week" + num + "_360_TB.mp4";
            switch (num)
            {
            case 0:
                sd_path = "http://cdn.cs50.net/2016/fall/lectures/0/week0_360_TB.mp4";
                break;

            case 1:
                sd_path = "http://cdn.cs50.net/2016/fall/lectures/1/week1_360_TB.mp4";
                break;

            case 2:
                sd_path = "http://cdn.cs50.net/2016/fall/lectures/2/week2_360_TB.mp4";
                break;

            case 3:
                sd_path = "http://cdn.cs50.net/2016/fall/lectures/0/yale/week0_360_TB.mp4";
                break;

            case 4:
                break;
            }
            Debug.Log("path is " + sd_path);
            if (m_bSupportRockchip)
            {
                Call_SetRockchip(m_bSupportRockchip);

                if (strName.Contains("://"))
                {
                    Call_Load(sd_path, 0);
                }
                else
                {
                    // sd_path = "http://cdn.cs50.net/2016/fall/lectures/0/week0_360_TB.mp4";
                    Call_Load(sd_path, 0);

                    // StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
                }
            }
            else
            {
                // sd_path = "http://cdn.cs50.net/2016/fall/lectures/0/week0_360_TB.mp4";
                Call_Load(sd_path, 0);
                //  Call_Load(strName,0);
            }
                        #endif
            Call_SetLooping(m_bLoop);
            m_bFirst = true;
        }


        if (m_CurrentState == MEDIAPLAYER_STATE.PLAYING || m_CurrentState == MEDIAPLAYER_STATE.PAUSED)
        {
            if (m_bCheckFBO == false)
            {
                if (Call_GetVideoWidth() <= 0 || Call_GetVideoHeight() <= 0)
                {
                    return;
                }

                Resize();

                if (m_VideoTexture != null)
                {
                    //Destroy(m_VideoTexture);

                    if (m_VideoTextureDummy != null)
                    {
                        Destroy(m_VideoTextureDummy);
                        m_VideoTextureDummy = null;
                    }

                    m_VideoTextureDummy = m_VideoTexture;
                    m_VideoTexture      = null;
                }

                                #if UNITY_ANDROID
                if (m_bSupportRockchip)
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(), Call_GetVideoHeight(), TextureFormat.RGB565, false);
                }
                else
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(), Call_GetVideoHeight(), TextureFormat.RGBA32, false);
                }

                m_VideoTexture.filterMode = FilterMode.Bilinear;
                m_VideoTexture.wrapMode   = TextureWrapMode.Clamp;

#if UNITY_5_2
                Call_SetUnityTexture((int)m_VideoTexture.GetNativeTexturePtr());
#else
                Call_SetUnityTexture(m_VideoTexture.GetNativeTextureID());
#endif
                                #endif
                Call_SetWindowSize();
                m_bCheckFBO = true;
            }


            Call_UpdateVideoTexture();



            m_iCurrentSeekPosition = Call_GetSeekPosition();
        }



        if (m_CurrentState != Call_GetStatus())
        {
            m_CurrentState = Call_GetStatus();



            if (m_CurrentState == MEDIAPLAYER_STATE.READY)
            {
                if (OnReady != null)
                {
                    OnReady();
                }

                if (m_bAutoPlay)
                {
                    Call_Play(0);
                }

                SetVolume(m_fVolume);
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.END)
            {
                if (OnEnd != null)
                {
                    OnEnd();
                }

                if (m_bLoop == true)
                {
                    Call_Play(0);
                }
            }
            else if (m_CurrentState == MEDIAPLAYER_STATE.ERROR)
            {
                OnError((MEDIAPLAYER_ERROR)Call_GetError(), (MEDIAPLAYER_ERROR)Call_GetErrorExtra());
            }
        }
    }
Ejemplo n.º 18
0
 private void Call_RePlay()
 {
     VideoPlayerPluginResumeVideo(m_iID);
     m_CurrentState = MEDIAPLAYER_STATE.PLAYING;
 }
Ejemplo n.º 19
0
	private void Call_RePlay()
	{
		VideoPlayerPluginResumeVideo(m_iID);
		m_CurrentState = MEDIAPLAYER_STATE.PLAYING;
	}
Ejemplo n.º 20
0
    public void Load(string strFileName)
    {
        m_bCheckFBO = false;

        m_strFileName = strFileName;

        if( m_bInit == false)
            return;

        #if UNITY_ANDROID

        //Call_Reset();

        #endif

        #if UNITY_IPHONE
        /*if (strFileName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
        {
            StartCoroutine(DownloadStreamingVideoAndLoad(m_strFileName));
        }
        else*/
        {
            Call_Load(m_strFileName,0);
        }

        #endif

        #if UNITY_ANDROID

        if(m_bSupportRockchip)
        {
            Call_SetRockchip(m_bSupportRockchip);

            if(strFileName.Contains("://"))
            {
                Call_Load(strFileName,0);
            }
            else
            {
                StartCoroutine( CopyStreamingAssetVideoAndLoad(strFileName));
            }

        }
        else
        {
            Call_Load(strFileName,0);
        }

        #endif

        m_CurrentState = MEDIAPLAYER_STATE.NOT_READY;
    }
Ejemplo n.º 21
0
	private void Call_Pause()
	{
		m_CurrentState = MEDIAPLAYER_STATE.PAUSED;
		VideoPlayerPluginPauseVideo(m_iID);
		
	}
Ejemplo n.º 22
0
    public void Stop()
    {
        if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING)
            Call_Pause();

        m_bStop = true;
        m_CurrentState = MEDIAPLAYER_STATE.STOPPED;
        m_iCurrentSeekPosition = 0;
    }
Ejemplo n.º 23
0
	void Update()
	{
		
		if( string.IsNullOrEmpty(m_strFileName) )
		{
			return;
		}
		
		
		if(m_bFirst == false)
		{
			
			
			
			
			
			string strName = m_strFileName.Trim();
			
			#if UNITY_IPHONE
			/*if (strName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
			{
				StartCoroutine( DownloadStreamingVideoAndLoad(strName) );
			}
			else*/
			{
				Call_Load(strName,0);
			}
			
			#endif
			#if UNITY_ANDROID
			
			if(m_bSupportRockchip)
			{
				Call_SetRockchip(m_bSupportRockchip);
				
				if(strName.Contains("://"))
				{
					Call_Load(strName,0);
				}
				else
				{
					//Call_Load(strName,0);
					StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
				}
				
			}
			else
			{
				Call_Load(strName,0);
			}
			
			
			#endif
			Call_SetLooping(m_bLoop);
			m_bFirst = true;
			
			
		}
		
		
		if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING || m_CurrentState == MEDIAPLAYER_STATE.PAUSED)
		{
			if(m_bCheckFBO == false)
			{
				if(Call_GetVideoWidth() <= 0 || Call_GetVideoHeight() <= 0)
				{
					return;
				}
				
				Resize();
				
				if(m_VideoTexture != null)
				{
					
					//Destroy(m_VideoTexture);
					
					if( m_VideoTextureDummy != null)
					{
						Destroy(m_VideoTextureDummy);
						m_VideoTextureDummy = null;
					}
					
					m_VideoTextureDummy = m_VideoTexture;
					m_VideoTexture = null;
					
					
				}
				
				#if UNITY_ANDROID
				if(m_bSupportRockchip)
				{
					m_VideoTexture = new Texture2D(Call_GetVideoWidth(),Call_GetVideoHeight(),TextureFormat.RGB565,false);
					
				}
				else
				{
					m_VideoTexture = new Texture2D(Call_GetVideoWidth(),Call_GetVideoHeight(),TextureFormat.RGBA32,false);
				}
				
				m_VideoTexture.filterMode = FilterMode.Bilinear;
				m_VideoTexture.wrapMode = TextureWrapMode.Clamp;

#if UNITY_5_2
				Call_SetUnityTexture((int)m_VideoTexture.GetNativeTexturePtr());
#else
				Call_SetUnityTexture(m_VideoTexture.GetNativeTextureID());
#endif
				#endif
				Call_SetWindowSize();
				m_bCheckFBO = true;
				
			}
			
			
			Call_UpdateVideoTexture();
			
			
			
			m_iCurrentSeekPosition = Call_GetSeekPosition();
			
			
			/*if( m_strFileName.StartsWith("rtsp",StringComparison.OrdinalIgnoreCase) || m_strFileName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
			{
			}
			else
			{
				if(m_iCurrentSeekPosition > (Call_GetDuration() - 500) & m_bLoop == true & (m_CurrentState == MEDIAPLAYER_STATE.PLAYING))
				{
					SeekTo(0);
				}
				
			}*/
			
		}
		
		
		
		if(m_CurrentState != Call_GetStatus() )
		{
			
			m_CurrentState = Call_GetStatus();
			
			
			
			if(m_CurrentState == MEDIAPLAYER_STATE.READY)
			{
				
				if(OnReady != null)
					OnReady();
				
				if(m_bAutoPlay)
					Call_Play (0);

				SetVolume(m_fVolume);
				
				
				
			}
			else if(m_CurrentState == MEDIAPLAYER_STATE.END)
			{
				if(OnEnd != null)
					OnEnd();
				
				if(m_bLoop == true)
				{
					Call_Play(0);
				}
			}
			else if(m_CurrentState == MEDIAPLAYER_STATE.ERROR)
			{
				OnError( (MEDIAPLAYER_ERROR)Call_GetError() ,(MEDIAPLAYER_ERROR)Call_GetErrorExtra() );
			}
			
		}
		
		
	}
Ejemplo n.º 24
0
    void Update()
    {
        if( string.IsNullOrEmpty(m_strFileName) )
        {
            return;
        }

        if(m_bFirst == false)
        {

            string strName = m_strFileName.Trim();

            #if UNITY_IPHONE
            /*if (strName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
            {
                StartCoroutine( DownloadStreamingVideoAndLoad(strName) );
            }
            else*/
            {
                Call_Load(strName,0);
            }

            #endif
            #if UNITY_ANDROID

            if(m_bSupportRockchip)
            {
                Call_SetRockchip(m_bSupportRockchip);

                if(strName.Contains("://"))
                {
                    Call_Load(strName,0);
                }
                else
                {
                    //Call_Load(strName,0);
                    StartCoroutine( CopyStreamingAssetVideoAndLoad(strName));
                }

            }
            else
            {
                Call_Load(strName,0);
            }

            #endif
            Call_SetLooping(m_bLoop);
            m_bFirst = true;

        }

        if(m_CurrentState == MEDIAPLAYER_STATE.PLAYING || m_CurrentState == MEDIAPLAYER_STATE.PAUSED)
        {
            if(m_bCheckFBO == false)
            {
                if(Call_GetVideoWidth() <= 0 || Call_GetVideoHeight() <= 0)
                {
                    return;
                }

                Resize();

                if(m_VideoTexture != null)
                {

                    //Destroy(m_VideoTexture);

                    if( m_VideoTextureDummy != null)
                    {
                        Destroy(m_VideoTextureDummy);
                        m_VideoTextureDummy = null;
                    }

                    m_VideoTextureDummy = m_VideoTexture;
                    m_VideoTexture = null;

                }

                #if UNITY_ANDROID
                if(m_bSupportRockchip)
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(),Call_GetVideoHeight(),TextureFormat.RGB565,false);

                }
                else
                {
                    m_VideoTexture = new Texture2D(Call_GetVideoWidth(),Call_GetVideoHeight(),TextureFormat.RGBA32,false);
                }

                m_VideoTexture.filterMode = FilterMode.Bilinear;
                m_VideoTexture.wrapMode = TextureWrapMode.Clamp;

                Call_SetUnityTexture(m_VideoTexture.GetNativeTextureID());
                #endif
                Call_SetWindowSize();
                m_bCheckFBO = true;

            }

            Call_UpdateVideoTexture();

            m_iCurrentSeekPosition = Call_GetSeekPosition();

            if( m_strFileName.StartsWith("rtsp",StringComparison.OrdinalIgnoreCase) || m_strFileName.StartsWith("http",StringComparison.OrdinalIgnoreCase))
            {
            }
            else
            {
                if(m_iCurrentSeekPosition > (Call_GetDuration() - 500) & m_bLoop == true & (m_CurrentState == MEDIAPLAYER_STATE.PLAYING))
                {
                    SeekTo(0);
                }

            }

        }

        if(m_CurrentState != Call_GetStatus() )
        {

            m_CurrentState = Call_GetStatus();

            if(m_CurrentState == MEDIAPLAYER_STATE.READY)
            {

                if(OnReady != null)
                    OnReady();

                if(m_bAutoPlay)
                    Call_Play (0);

            }
            else if(m_CurrentState == MEDIAPLAYER_STATE.END)
            {
                if(OnEnd != null)
                    OnEnd();

                if(m_bLoop == true)
                {
                    Call_Play(0);
                }
            }
            else if(m_CurrentState == MEDIAPLAYER_STATE.ERROR)
            {
                OnError( (MEDIAPLAYER_ERROR)Call_GetError() ,(MEDIAPLAYER_ERROR)Call_GetErrorExtra() );
            }

        }
    }
Ejemplo n.º 25
0
 public void StopVideo()
 {
     m_CurrentState = MEDIAPLAYER_STATE.END;
 }