コード例 #1
0
 public void SetDefinitionModel(MifengPlayer.DefnInfo info)
 {
     if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
     {
         mPlayer.switchDefinition(info);
     }
 }
コード例 #2
0
    private void Update()
    {
#if UNITY_ANDROID
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            UpdateVideoRenderTexture();
        }
        else
        {
            if (IsVideoReady)
            {
                mPlayer.updateTexture();
            }
        }
#endif

        if (Input.GetKeyDown(KeyCode.P))
        {
            OnVideoEvent(VideoEvent.VIDEO_BUFFER_START, 0);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            OnVideoEvent(VideoEvent.VIDEO_BUFFER_FINISH, 0);
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            OnVideoEventBufferingProgress(VideoEvent.VIDEO_BUFFER_PROGRESS, 0, 122);
        }
    }
コード例 #3
0
    public void SetVolumePercent(float percent)
    {
#if UNITY_ANDROID
        if (percent < 0)
        {
            percent = 0;
        }
        else if (percent > 1)
        {
            percent = 1;
        }

        int value = Mathf.FloorToInt(MaxVolume * percent);
        if (percent != 0 && value == 0)
        {
            value = 1;
        }
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayerPtr == IntPtr.Zero)
            {
                return;
            }
            SetCurrentVolume(VideoPlayerPtr, value);
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            mPlayer.setCurrentVolume(value);
        }
#endif
    }
コード例 #4
0
    public long GetCurrentPosition()
    {
#if UNITY_ANDROID
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayerPtr == IntPtr.Zero)
            {
                return(0);
            }

            return(GetCurrentPosition(VideoPlayerPtr));
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            return(mPlayer.getCurrentVideoTime());
        }
        else
        {
            return(0);
        }
#else
        return(0);
#endif
    }
コード例 #5
0
    public int GetVideoHeight()
    {
#if UNITY_ANDROID
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayerPtr == IntPtr.Zero)
            {
                return(0);
            }

            return(GetHeight(VideoPlayerPtr));
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            return(mPlayer.getVideoHeight());
        }
        else
        {
            return(0);
        }
#else
        return(0);
#endif
    }
コード例 #6
0
    /// <summary>
    /// 本地MediaPlayer调用播放
    /// </summary>
    /// <param name="videoIndex"></param>
    void PlayNewVideo(int videoIndex)
    {
        Cinema.IsPlayOrPauseVideoPlayer = true;
        CurJVideoInfo = null;
        JVideoDescriptionInfo jVdi = PlayerDataControl.GetInstance().GetJVideoDscpInfoByIndex(videoIndex);

        if (jVdi == null)
        {
            return;
        }

        //shemi
        //LocalVideosPanel.VideosViewPanel.ResetCurVideoId(jVdi.id);
        PlayNewVideoBase(jVdi);

        //没有识别过立体格式&&底层没有传送格式&&格式识别的图片不是null
        if ((jVdi.stereoType < 0 || jVdi.stereoType > 8) &&
            !VideoFormatDictionaryDetector.GetInstance().HasVideoFormatOrNotByVideoId(jVdi.id.ToString()) &&
            jVdi.recognitionImagePath != null)
        {
            StartCoroutine(/*Cinema.VideoManage.MediaManage.*/ GlobalRunningFunction.Instance.LoadImageAndAnalyze.StartAnalyzeImageThread(jVdi.id, jVdi.recognitionImagePath));
        }
        else
        {
            PlayVideoAfterAnalyze(videoIndex, null);
        }
    }
コード例 #7
0
    /// <summary>
    /// Convert the volume value to a percentage value
    /// </summary>
    /// <returns>percentage volume value</returns>
    public float GetCurrentVolumePercent()
    {
        try
        {
#if UNITY_ANDROID
            if ((PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
                 PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl) && VideoPlayerPtr == IntPtr.Zero)
            {
                return(0);
            }

            int   CurrentVolume        = GetCurrentVolume();
            int   maxVolume            = GetMaxVolume();
            float CurrentVolumePercent = 0;
            if (maxVolume != 0)
            {
                CurrentVolumePercent = (float)CurrentVolume / maxVolume;
            }
            return(CurrentVolumePercent);
#endif
        }
        catch (Exception e)
        {
            Debug.Log("GetCurrentVolumePercent have exception" + e.Message);
            return(0.5f);
        }
    }
コード例 #8
0
    void ChangeStereoType(StereoType stereoType)
    {
        if (/*!GlobalVariable.IsIntent && */ !IsPlayLoop)
        {
            if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local)
            {
                VideoFormatDictionaryDetector.GetInstance().SetVideoFormatTypeByVideoId(CurJVideoInfo.id.ToString(), (int)stereoType);
            }
            else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
            {
                VideoFormatDictionaryDetector.GetInstance().SetVideoFormatTypeByVideoId
                    (string.Format("{0}-{1}", CurJVideoInfo.vid, CurJVideoInfo.cid), (int)stereoType);
            }
            else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
            {
                VideoFormatDictionaryDetector.GetInstance().SetVideoFormatTypeByVideoId(CurJVideoInfo.uri, (int)stereoType);
            }
        }
        else if (IsPlayLoop)
        {
            VideoPlayerPanel.SetVideoFormatTypeWhenPlayLoop((int)stereoType);
        }

        if (CurJVideoInfo != null)
        {
            CurJVideoInfo.stereoType = (int)stereoType;
        }
        Cinema.VideoPlayer.SetPlayMode(stereoType);
        ImaxPurpleControlByStereoType(stereoType);
        WindowStereoTypeUIReset();
    }
コード例 #9
0
    private void StartPlayNewVideo()
    {
        PlayingURLMode curPlayingMode = PlayerDataControl.GetInstance().CurPlayingMode;

        if ((curPlayingMode == PlayingURLMode.KTTV || curPlayingMode == PlayingURLMode.LiveUrl) &&
            !GlobalVariable.IsInternetReachability())
        {
            ShowErrorMessageAndBackList(ExceptionEvent.EXCEPTION_NETWORK_ERROR, "Cinema.SvrVideoPlayer.OnExceptionEvent.Video.NETWORK_ERROR");
            return;
        }

        Cinema.IsPlayEndWhenKTTVModel = false;
        if (curPlayingMode == PlayingURLMode.Local)
        {
            PlayNewVideo(PlayerDataControl.GetInstance().GetCurPlayIndex());
        }
        else if (curPlayingMode == PlayingURLMode.KTTV)
        {
            PlayNewVideo(PlayerDataControl.GetInstance().GetKKTVVideoVidCid());
        }
        else if (curPlayingMode == PlayingURLMode.LiveUrl)
        {
            PlayNewVideo(PlayerDataControl.GetInstance().GetJVideoDscpInfoByLiveUrl());
        }
    }
コード例 #10
0
    /// <summary>
    /// Need to release resources before exiting the application
    /// </summary>
    public void Release()
    {
#if UNITY_ANDROID
        if (IsRelased)
        {
            return;
        }
        IsRelased = true;

        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayerPtr == IntPtr.Zero)
            {
                return;
            }
            DestroyVideoPlayer(VideoPlayerPtr);
            VideoPlayerPtr = IntPtr.Zero;
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            mPlayer.release();
        }

        IsVideoReady = false;
        ReadyPlay    = false;
        IsInit       = false;
        mPlayer      = null;
        ResetPlayerTextureDefault();
#endif
    }
コード例 #11
0
    void Awake()
    {
        if (PlayerDataControl.GetInstance().CurPlayingMode != PlayingURLMode.KTTV)
        {
            InitCinemaNativeInterface("playermanager");
        }

        AnalizePlayMode();
    }
コード例 #12
0
 private void ReleaseInterface()
 {
     if (PlayerDataControl.GetInstance().CurPlayingMode != PlayingURLMode.KTTV)
     {
         if (AndroidPlayerInterface != null)
         {
             AndroidPlayerInterface.Call("release");
         }
     }
 }
コード例 #13
0
    void PlayNextVideo()
    {
        int index = PlayerDataControl.GetInstance().VideoPlayManage.GetNextVideoIndex();

        if (index == -1)
        {
            return;
        }

        Cinema.VideoPlayer.Stop();
        PlayNewVideo(index);
    }
コード例 #14
0
    void BindEvents()
    {
        Cinema.RecenterCallback   = Recenter;
        Cinema.ResetUIDirCallback = ShowVideoPlayerUI;
        Cinema.SwitchVideoPlayerUIVisionCallback = SwitchVideoPlayerUIVision;
        Cinema.FocusCompleteCallback             = FocusComplete;
        Cinema.VideoPlayer.OnReady          = VideoReadyComplete;
        Cinema.VideoPlayer.OnEnd            = VideoPlayComplete;
        Cinema.VideoPlayer.OnVolumeChange   = VideoVolumeChangedEvent;
        Cinema.VideoPlayer.OnVideoError     = ShowErrorMessageAndBackList;
        Cinema.VideoPlayer.OnProgressChange = UpdatePlayingProgress;
        Cinema.VideoPlayer.ScreenSizeBtnStatusControlCallback += VideoSettingsUIControl;
        //Cinema.VideoPlayer.ScreenSizeBtnStatusControlCallback += SubtitleUIControl;
        Cinema.VideoPlayer.TensileBtnStatusControlCallback = TensileBtnStatusControl;
        Cinema.VideoPlayer.FinishIntent             = BackLocalMediaPanel;
        Cinema.VideoPlayer.SetSubtitle              = SetMovieSubtitle;
        Cinema.VideoPlayer.ReleaseInterfaceCallback = ReleaseInterface;
        Cinema.VideoPlayer.DMR_PlayVideoCallback    = PlayVideo;
        Cinema.VideoPlayer.DMR_PauseVideoCallback   = DmrPauseVideo;
        Cinema.VideoPlayer.ChangeSceneStyleCallback = ChangeSceneStyle;
        Cinema.VideoPlayer.AdRemainingTimeCallback  = EnableOrEndAd;
        Cinema.VideoPlayer.DefinitionListCallback   = GetDefinitionList;
        Cinema.VideoPlayer.VideoDurationCallback    = UpdateVideoTotalTime;
        Cinema.VideoPlayer.OnBufferProgressChange   = OnBufferProgress;
        Cinema.VideoPlayer.OnBufferStart            = OnBufferStartShowLoading;
        Cinema.VideoPlayer.OnBufferFinish           = OnBufferFinishHideLoading;

        VideoPlayerPanel.ChangeStereoTypeCallback = ChangeStereoType;
        VideoPlayerPanel.PointerEnterUICallback   = PointerEnterVideoPlayerUI;
        VideoPlayerPanel.GetVideoCurrentTimePtr   = Cinema.VideoPlayer.GetCurrentPosition;
        VideoPlayerPanel.UIRecenterCallback       = RecenterControlUI;

        VideoPlayerPanel.VideoCtrlPanel.ClickBackBtnCallback                 += BackLocalMediaPanel;
        VideoPlayerPanel.VideoCtrlPanel.ClickPlayBtnCallback                  = PlayVideo;
        VideoPlayerPanel.VideoCtrlPanel.ClickPlayBtnAndReplayCallback         = StartPlayNewVideo;
        VideoPlayerPanel.VideoCtrlPanel.ClickPauseBtnCallback                 = PauseVideo;
        VideoPlayerPanel.VideoCtrlPanel.ClickPreviousBtnCallback              = PlayPreviousVideo;
        VideoPlayerPanel.VideoCtrlPanel.ClickNextBtnCallback                  = PlayNextVideo;
        VideoPlayerPanel.VideoCtrlPanel.PlayPBPanel.SeekToTimeCallback        = SeekToTime;
        VideoPlayerPanel.VideoCtrlPanel.VolumeValueChangedByUICallback        = VolumeValueChanged;
        VideoPlayerPanel.VideoCtrlPanel.PlayPBPanel.SliderCheckStatusCallback = SliderCheckStatus;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.SceneChangePanel.ChangeSceneStyleCallback      = ChangeSceneStyle;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.LoopModePanel.ChangeLoopTypeCallback           = SelectLoopType;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.LoopModePanel.ChangeAutoPlayCallback           = SetPlayMode;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.StereoTypePanel.TensileSwitchCallback          = StretchingPicture;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.DefinitionPanel.ChangeDefinitionModelCallback += ChangeDefinitionModel;
        VideoPlayerPanel.VideoCtrlPanel.ClickLockBtnCallback = LockAngleEvent;
        VideoPlayerPanel.ShowUICallback = LoadSceneWhenShowUI;

        //HomeButtonListener.Instance.HomeButtonCallback += HomeButtonBack;
        //HomeButtonListener.Instance.BackButtonCallback += BackButtonBack;
        PlayerDataControl.GetInstance().InterruptPlayer += BackLocalMediaPanel;
    }
コード例 #15
0
 private static IntPtr ToIntPtr(System.Object obj)
 {
     if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
         PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
     {
         GCHandle handle = GCHandle.Alloc(obj);
         return(GCHandle.ToIntPtr(handle));
     }
     else
     {
         return(IntPtr.Zero);
     }
 }
コード例 #16
0
 void OnDestroy()
 {
     fileSelector = GetComponent <FileSelectorPageProvider>();
     if (fileSelector != null)
     {
         fileSelector.OnFileChosen -= OnFileChosen;
     }
     MediaPlayerEventDispatcher.OnExitMedia    -= OnExitMedia;
     MediaPlayerEventDispatcher.OnNextFile     -= OnNextFile;
     MediaPlayerEventDispatcher.OnPreviousFile -= OnPreviousFile;
     PlayerDataControl.GetInstance().StopPlayCallBack -= DestroyMediaPlayer;
     DvDInterface.GetInstance().DiskUnLockCallBack    -= OnDiskUnLocK;
     DvDInterface.GetInstance().DiskUpdateCallBack    -= OnDIskUpdateCD;
 }
コード例 #17
0
 void  OnDiskUnLock()
 {
     MainThreadQueue.ExecuteQueue.Enqueue(() =>
     {
         if (PlayerDataControl.GetInstance().InterruptPlayer != null)
         {
             PlayerDataControl.GetInstance().InterruptPlayer();
         }
         if (DiskUnLockCallBack != null)
         {
             DiskUnLockCallBack();
         }
     });
 }
コード例 #18
0
    public void Init()
    {
        ScreenSizePanel.Init();
        StereoTypePanel.Init();
        SceneChangePanel.Init();
        LoopModePanel.Init();
        DefinitionPanel.Init();

        IsEnter = false;
        IsShow  = false;
        ScreenSizeBtnIsInteractable  = true;
        SceneChangeBtnIsInteractable = true;

        EventTriggerListener.Get(this.gameObject).OnPtEnter           = OnPointerEnterUI;
        EventTriggerListener.Get(this.gameObject).OnPtExit            = OnPointerExitUI;
        EventTriggerListener.Get(ScreenSizeBtn.gameObject).OnPtEnter  = OnPointerEnterScreenSizeBtn;
        EventTriggerListener.Get(ScreenSizeBtn.gameObject).OnPtExit   = OnPointerExitScreenSizeBtn;
        EventTriggerListener.Get(StereoTypeBtn.gameObject).OnPtEnter  = OnPointerEnterUI;
        EventTriggerListener.Get(StereoTypeBtn.gameObject).OnPtExit   = OnPointerExitUI;
        EventTriggerListener.Get(SceneChangeBtn.gameObject).OnPtEnter = OnPointerEnterSceneChangeBtn;
        EventTriggerListener.Get(SceneChangeBtn.gameObject).OnPtExit  = OnPointerExitSceneChangeBtn;
        EventTriggerListener.Get(LoopModeBtn.gameObject).OnPtEnter    = OnPointerEnterUI;
        EventTriggerListener.Get(LoopModeBtn.gameObject).OnPtExit     = OnPointerExitUI;
        EventTriggerListener.Get(DefinitionBtn.gameObject).OnPtEnter  = OnPointerEnterUI;
        EventTriggerListener.Get(DefinitionBtn.gameObject).OnPtExit   = OnPointerExitUI;

        EventTriggerListener.Get(ScreenSizeBtn.gameObject).OnPtClick  = ClickScreenSizeBtn;
        EventTriggerListener.Get(StereoTypeBtn.gameObject).OnPtClick  = ClickStereoTypeBtn;
        EventTriggerListener.Get(SceneChangeBtn.gameObject).OnPtClick = ClickSceneChangeBtn;
        EventTriggerListener.Get(LoopModeBtn.gameObject).OnPtClick    = ClickLoopModeBtn;
        EventTriggerListener.Get(DefinitionBtn.gameObject).OnPtClick  = ClickDefinitionBtn;

        SceneChangePanel.PointerEnterBtnCallback       = PointerEnterBtn;
        ScreenSizePanel.PointerEnterBtnCallback        = PointerEnterBtn;
        LoopModePanel.PointerEnterBtnCallback          = PointerEnterBtn;
        DefinitionPanel.PointerEnterBtnCallback        = PointerEnterBtn;
        DefinitionPanel.ChangeDefinitionModelCallback += ChangeDefinitionModel;

        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            LoopModeBtn.gameObject.SetActive(true);
            DefinitionBtn.gameObject.SetActive(false);
        }
        else
        {
            LoopModeBtn.gameObject.SetActive(false);
            DefinitionBtn.gameObject.SetActive(true);
        }
    }
コード例 #19
0
 void Awake()
 {
     scrollRect   = GetComponent <PagedScrollRect>();
     fileSelector = GetComponent <FileSelectorPageProvider>();
     Assert.IsNotNull(fileSelector);
     fileSelector.OnFileChosen += OnFileChosen;
     //fileSelector.AllowedExtensions = MediaHelpers.EXTENSIONS_TO_MEDIA_TYPE.Keys.ToArray();
     MediaPlayerEventDispatcher.OnExitMedia    += OnExitMedia;
     MediaPlayerEventDispatcher.OnNextFile     += OnNextFile;
     MediaPlayerEventDispatcher.OnPreviousFile += OnPreviousFile;
     PlayerDataControl.GetInstance().StopPlayCallBack += DestroyMediaPlayer;
     DvDInterface.GetInstance().DiskUnLockCallBack    += OnDiskUnLocK;
     DvDInterface.GetInstance().DiskUpdateCallBack    += OnDIskUpdateCD;
 }
コード例 #20
0
    /// <summary>
    /// Set single loop
    /// </summary>
    /// <param name="isLoop"></param>
    public void SetLoop(bool isLoop)
    {
#if UNITY_ANDROID
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            return;
        }

        if (VideoPlayerPtr == IntPtr.Zero)
        {
            return;
        }

        SetLoop(VideoPlayerPtr, isLoop);
#endif
    }
コード例 #21
0
    void SelectLoopType(bool isLoop)
    {
        LoopType loopType = VideoPlayManage.CurLoopType;

        if (isLoop)
        {
            loopType = LoopType.SinglePlay;
        }
        else
        {
            loopType = LoopType.ListLoop;
        }

        PlayerDataControl.GetInstance().VideoPlayManage.SetLoopType(loopType);
        Cinema.VideoPlayer.SetLoop(isLoop);
    }
コード例 #22
0
    void SetStereoTypeForUI(int stereoType = -1)
    {
        int type;

        if (stereoType == -1)
        {
            type = CurJVideoInfo.stereoType;
            if (type > 8)
            {
                type = 6;
            }

            if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local)
            {
                if (VideoFormatDictionaryDetector.GetInstance().HasVideoFormatOrNotByVideoId(CurJVideoInfo.id.ToString()))
                {
                    type = VideoFormatDictionaryDetector.GetInstance().GetVideoFormatTypeByVideoId(CurJVideoInfo.id.ToString());
                }
            }
            else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
            {
                string id = string.Format("{0}-{1}", CurJVideoInfo.vid, CurJVideoInfo.cid);
                if (VideoFormatDictionaryDetector.GetInstance().HasVideoFormatOrNotByVideoId(id))
                {
                    type = VideoFormatDictionaryDetector.GetInstance().GetVideoFormatTypeByVideoId(id);
                }
            }
            else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
            {
                if (VideoFormatDictionaryDetector.GetInstance().HasVideoFormatOrNotByVideoId(CurJVideoInfo.uri))
                {
                    type = VideoFormatDictionaryDetector.GetInstance().GetVideoFormatTypeByVideoId(CurJVideoInfo.uri);
                }
            }
        }
        else
        {
            type = stereoType;
        }

        CurJVideoInfo.stereoType = type;
        LogTool.Log("播放格式:" + (StereoType)type);
        Cinema.VideoPlayer.SetPlayMode((StereoType)type);
        ImaxPurpleControlByStereoType((StereoType)type);
        VideoPlayerPanel.ShowUI();
        WindowStereoTypeUIReset();
    }
コード例 #23
0
 void EnableOrEndAd(long remainingTime)
 {
     if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
     {
         if (remainingTime > 0 && !isEnterAdFirst)
         {
             isEnterAdFirst = true;
             VideoPlayerPanel.VideoCtrlPanel.PlayBtnControl(true);
             VideoPlayerPanel.VideoCtrlPanel.PlayPBPanel.EnableOrDisableSlider(true);
         }
         else if (remainingTime <= 0 && isEnterAdFirst)
         {
             isEnterAdFirst = false;
             VideoPlayerPanel.VideoCtrlPanel.PlayBtnControl(false);
             VideoPlayerPanel.VideoCtrlPanel.PlayPBPanel.EnableOrDisableSlider(false);
         }
     }
 }
コード例 #24
0
    /// <summary>
    /// Get current video player states.
    /// </summary>
    /// <returns>player states</returns>
    public VideoPlayerState GetPlayerState()
    {
#if UNITY_ANDROID
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            return(VideoPlayerState.Idle);
        }

        if (VideoPlayerPtr == IntPtr.Zero)
        {
            return(VideoPlayerState.Idle);
        }

        return((VideoPlayerState)GetPlayerState(VideoPlayerPtr));
#else
        return(VideoPlayerState.Idle);
#endif
    }
コード例 #25
0
    public void Show()
    {
        if (IsShow)
        {
            return;
        }

        IsShow = true;
        gameObject.SetActive(true);
        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            NextBtn.interactable = false;
            NextBtn.GetComponent <Image>().raycastTarget = false;
            Image NextBtnChildImage = NextBtn.transform.GetChild(0).gameObject.GetComponent <Image>();
            NextBtnChildImage.color = new Color(NextBtnChildImage.color.r, NextBtnChildImage.color.g, NextBtnChildImage.color.b, 0.3f);
        }
    }
コード例 #26
0
    public void Show()
    {
        if (IsShow)
        {
            return;
        }

        IsShow = true;

        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayManage.CurLoopType == LoopType.SinglePlay)
            {
                SingleCycleBtn.SetSelected(true);
            }
            else
            {
                SingleCycleBtn.SetSelected(false);
            }
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            SingleCycleBtn.SetSelected(false);
            SingleCycleBtnIsDisable = true;
            Image SingleCycleBtnImage = SingleCycleBtn.GetComponent <Image>();
            SingleCycleBtnImage.raycastTarget = false;
            SingleCycleBtnImage.color         = new Color(SingleCycleBtnImage.color.r, SingleCycleBtnImage.color.g, SingleCycleBtnImage.color.b, 0.3f);
            Text SingleCycleBtnText = SingleCycleBtn.GetComponentInChildren <Text>();
            SingleCycleBtnText.color = new Color(SingleCycleBtnText.color.r, SingleCycleBtnText.color.g, SingleCycleBtnText.color.b, 0.3f);
        }

        if (CinemaPanel.IsPlayLoop)
        {
            AutoPlayBtn.SetSelected(true);
        }
        else
        {
            AutoPlayBtn.SetSelected(false);
        }

        this.gameObject.SetActive(true);
    }
コード例 #27
0
    public void Stop()
    {
#if UNITY_ANDROID
        ReadyPlay    = false;
        IsVideoReady = false;

        if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
            PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
        {
            if (VideoPlayerPtr == IntPtr.Zero)
            {
                return;
            }

            StopVideo(VideoPlayerPtr);
            ResetPlayer(VideoPlayerPtr);
        }
        else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
        {
            mPlayer.stopVideo();
        }

        if (IsNeedFreeTexeture)
        {
            if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
                PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl)
            {
                IssuePlayerEvent(SurfaceTextureId * 100, RenderCommand.FreeTexture);
            }
            else if (PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.KTTV)
            {
                mPlayer.releaseTexture();
            }

            IsNeedFreeTexeture = false;
            ResetPlayerTextureDefault();
        }
#endif

        ////发送null回调是为了清空字幕
        //if (SetSubtitle != null)
        //    SetSubtitle(null);
    }
コード例 #28
0
    private void OnDestroy()
    {
        //HomeButtonListener.Instance.HomeButtonCallback -= HomeButtonBack;
        //HomeButtonListener.Instance.BackButtonCallback -= BackButtonBack;

        Cinema.VideoPlayer.ScreenSizeBtnStatusControlCallback -= VideoSettingsUIControl;
        //Cinema.VideoPlayer.ScreenSizeBtnStatusControlCallback -= SubtitleUIControl;
        VideoPlayerPanel.VideoCtrlPanel.ClickBackBtnCallback -= BackLocalMediaPanel;
        VideoPlayerPanel.VideoCtrlPanel.SettingsPanel.DefinitionPanel.ChangeDefinitionModelCallback -= ChangeDefinitionModel;
        PlayerDataControl.GetInstance().InterruptPlayer -= BackLocalMediaPanel;

        if (Svr.SvrSetting.IsVR9Device)
        {
            Application.targetFrameRate = 72;
        }

        Cinema           = null;
        VideoPlayerPanel = null;
    }
コード例 #29
0
    private void OnApplicationPause(bool pause)
    {
#if UNITY_ANDROID
        if ((PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.Local ||
             PlayerDataControl.GetInstance().CurPlayingMode == PlayingURLMode.LiveUrl) && VideoPlayerPtr == IntPtr.Zero)
        {
            return;
        }

        if (pause && ReadyPlay)
        {
            Pause();
            ReadyPlay = true;
        }
        else if (ReadyPlay)
        {
            Play();
        }
#endif
    }
コード例 #30
0
 void BackLocalMediaPanel()
 {
     Cinema.GvrHead.trackPosition = true;
     isEnterAdFirst = false;
     Cinema.VideoPlayer.Stop();
     //Cinema.VideoPlayer.Release();
     PlayerDataControl.GetInstance().ClearVideoDscpInfo();
     CinemaTipsCanvasControl.GetInstance().GlobalToast.Hide();
     //CinemaGlobalToastCanvasControl.GetInstance().GlobalToast.Hide();
     //OnBufferFinishHideLoading();
     MediaStretchPlayerPrefsDetector.GetInstance().ResetMediaId();
     //GlobalRunningFunction.Instance.Subtitle.transform.parent = GameObject.FindGameObjectWithTag("MainCamera").transform.parent;
     //GlobalRunningFunction.Instance.ShowControllerRayLine();
     //Cinema.ResetSphereScreenDir(); //reset 360 model's dir
     Cinema.VideoPlayer.ClearVideoCache();
     if (PlayerDataControl.GetInstance().StopPlayCallBack != null)
     {
         PlayerDataControl.GetInstance().StopPlayCallBack();
     }
 }