Exemplo n.º 1
0
        public AndroidMediaPlayer(bool useFastOesPath, bool showPosterFrame, Android.VideoApi api, bool enable360Audio, Audio360ChannelMode channelMode, bool preferSoftware)
        {
            m_API = api;
            // Create a java-size video class up front
            m_Video = s_Interface.Call <AndroidJavaObject>("CreatePlayer", (int)m_API, useFastOesPath, enable360Audio, (int)channelMode, preferSoftware);

            if (m_Video != null)
            {
                m_Method_SetHeadRotation         = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "SetHeadRotation", "(FFFF)V", false);
                m_Method_SetFocusProps           = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "SetFocusProps", "(FF)V", false);
                m_Method_SetFocusEnabled         = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "SetFocusEnabled", "(Z)V", false);
                m_Method_SetFocusRotation        = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "SetFocusRotation", "(FFFF)V", false);
                m_Method_GetCurrentTimeMs        = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "GetCurrentTimeMs", "()J", false);
                m_Method_GetSourceVideoFrameRate = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "GetSourceVideoFrameRate", "()F", false);
                m_Method_IsPlaying   = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsPlaying", "()Z", false);
                m_Method_IsPaused    = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsPaused", "()Z", false);
                m_Method_IsFinished  = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsFinished", "()Z", false);
                m_Method_IsSeeking   = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsSeeking", "()Z", false);
                m_Method_IsBuffering = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsBuffering", "()Z", false);
                m_Method_IsLooping   = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "IsLooping", "()Z", false);
                m_Method_HasVideo    = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "HasVideo", "()Z", false);
                m_Method_HasAudio    = AndroidJNIHelper.GetMethodID(m_Video.GetRawClass(), "HasAudio", "()Z", false);

                m_iPlayerIndex = m_Video.Call <int>("GetPlayerIndex");
                Helper.LogInfo("Creating player " + m_iPlayerIndex);
                //Debug.Log( "AVPro: useFastOesPath: " + useFastOesPath );
                SetOptions(useFastOesPath, showPosterFrame);

                // Initialise renderer, on the render thread
                AndroidMediaPlayer.IssuePluginEvent(Native.AVPPluginEvent.PlayerSetup, m_iPlayerIndex);
            }
        }
Exemplo n.º 2
0
        public AndroidMediaPlayer(bool useFastOesPath, bool showPosterFrame, Android.VideoApi api, bool enable360Audio, Audio360ChannelMode channelMode)
        {
            m_API = api;
            // Create a java-size video class up front
            m_Video = s_Interface.Call <AndroidJavaObject>("CreatePlayer", (int)m_API, enable360Audio, (int)channelMode);

            if (m_Video != null)
            {
                m_iPlayerIndex = m_Video.Call <int>("GetPlayerIndex");
                Debug.Log("AVProVideo creating player " + m_iPlayerIndex);
                //Debug.Log( "AVPro: useFastOesPath: " + useFastOesPath );
                SetOptions(useFastOesPath, showPosterFrame);

                // Initialise renderer, on the render thread
                AndroidMediaPlayer.IssuePluginEvent(Native.AVPPluginEvent.PlayerSetup, m_iPlayerIndex);
            }
        }
Exemplo n.º 3
0
        public AndroidMediaPlayer(bool useFastOesPath, bool showPosterFrame, Android.VideoApi api, bool enable360Audio, Audio360ChannelMode channelMode, bool preferSoftware)
        {
#if UNITY_5 || UNITY_5_4_OR_NEWER
            Debug.Assert(s_Interface != null);
            Debug.Assert(s_bInitialised);
#endif
            m_API = api;
            // Create a java-size video class up front
            m_Video = s_Interface.Call <AndroidJavaObject>("CreatePlayer", (int)m_API, useFastOesPath, enable360Audio, (int)channelMode, preferSoftware);

            if (m_Video != null)
            {
                m_Method_Update                  = GetMethod("Update", "()V");
                m_Method_SetHeadRotation         = GetMethod("SetHeadRotation", "(FFFF)V");
                m_Method_SetFocusProps           = GetMethod("SetFocusProps", "(FF)V");
                m_Method_SetFocusEnabled         = GetMethod("SetFocusEnabled", "(Z)V");
                m_Method_SetFocusRotation        = GetMethod("SetFocusRotation", "(FFFF)V");
                m_Method_GetCurrentTimeMs        = GetMethod("GetCurrentTimeMs", "()J");
                m_Method_GetSourceVideoFrameRate = GetMethod("GetSourceVideoFrameRate", "()F");
                m_Method_IsPlaying               = GetMethod("IsPlaying", "()Z");
                m_Method_IsPaused                = GetMethod("IsPaused", "()Z");
                m_Method_IsFinished              = GetMethod("IsFinished", "()Z");
                m_Method_IsSeeking               = GetMethod("IsSeeking", "()Z");
                m_Method_IsBuffering             = GetMethod("IsBuffering", "()Z");
                m_Method_IsLooping               = GetMethod("IsLooping", "()Z");
                m_Method_HasVideo                = GetMethod("HasVideo", "()Z");
                m_Method_HasAudio                = GetMethod("HasAudio", "()Z");

                m_iPlayerIndex = m_Video.Call <int>("GetPlayerIndex");
                Helper.LogInfo("Creating player " + m_iPlayerIndex);
                Debug.Log("AVPro: useFastOesPath: " + useFastOesPath);
                SetOptions(useFastOesPath, showPosterFrame);

                // Initialise renderer, on the render thread
                AndroidMediaPlayer.IssuePluginEvent(Native.AVPPluginEvent.PlayerSetup, m_iPlayerIndex);
            }
            else
            {
                Debug.LogError("[AVProVideo] Failed to create player instance");
            }
        }