예제 #1
0
    /// <summary>
    /// Major role is set data source
    /// </summary>
    /// <param name="svrVideoInfo">BaseVideoInfo data</param>
    public void PreparedPlayVideo(JVideoDescriptionInfo svrVideoInfo)
    {
#if UNITY_ANDROID
        if (VideoPlayerPtr == IntPtr.Zero)
        {
            Debug.Log("VideoPlayerPtr:为IntPtr.Zero");
            return;
        }

        MediaStretchPlayerPrefsDetector.GetInstance().SetMediaId(svrVideoInfo.id.ToString());
        string json = JsonUtility.ToJson(svrVideoInfo);
        Debug.Log("svrVideoInfo json:" + json);
        IsVideoReady = false;

        VideoPlayerPtr     = SetDataSource(VideoPlayerPtr, json);
        IsNeedFreeTexeture = true;
        IssuePlayerEvent(VideoPlayerEventBase, RenderCommand.InitializePlayer);

        //shemi:: 之后需要更换为扫描本地字幕,扫描回调中再设置字幕
        //string path = svrVideoInfo.uri;
        //path = MediaManage.GetPath((int)MediaType.Video ,path);
        //path = path.Substring(0, path.LastIndexOf("."));
        //SetSubtitleSource(VideoPlayerPtr, string.Format("{0}.srt", path));

        VideoWidth  = svrVideoInfo.width;
        VideoHeight = svrVideoInfo.height;
        Debug.Log("VideoScreenWidth:" + VideoWidth + " VideoScreenHeight:" + VideoHeight);
        LogTool.Log("SetDataSource success");
#endif
    }
예제 #2
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);
        }
    }
예제 #3
0
    public void SetVideoPlayerState(JVideoDescriptionInfo jVdi)
    {
        CurJVideoDscpInfo = jVdi;

        VideoCtrlPanel.SetVideoName(jVdi.name);
        VideoCtrlPanel.SetVideoCurrentTime(0);
        VideoCtrlPanel.SetPlayMode(true);
    }
예제 #4
0
    void RecordVideoPlayEvent(JVideoDescriptionInfo video)
    {
        Common.GetInstance().SetAttributes("视频类型", StereoTypeToWebStereoString((StereoType)video.stereoType));
        int secound = (int)(video.time / 1000);

        Common.GetInstance().SetAttributes("视频时长", string.Format("{0}", secound));
        Statistics.GetInstance().OnEvent(MediaCenterEvent.VideoPlay, "视频播放", 1, Common.GetInstance().GetAttributes());
        Common.GetInstance().ClearAttributes();
    }
예제 #5
0
    void PlayNewVideoBase(JVideoDescriptionInfo jVdi)
    {
        if (IsInvoking("BackLocalMediaPanel"))
        {
            CancelInvoke("BackLocalMediaPanel");
        }

        CurJVideoInfo = jVdi;
        VideoPlayerPanel.SetVideoPlayerState(jVdi);
        VideoPlayerPanel.VideoCtrlPanel.PlayBtnControl(true);
    }
예제 #6
0
    /// <summary>
    /// KKTV调用播放
    /// </summary>
    /// <param name="dic"></param>
    void PlayNewVideo(Dictionary <string, string> dic)
    {
        Cinema.IsPlayOrPauseVideoPlayer = true;
        CurJVideoInfo = null;

        JVideoDescriptionInfo jdi = new JVideoDescriptionInfo();

        jdi.vid        = dic["vid"];
        jdi.cid        = dic["cid"];
        jdi.name       = dic["name"];
        jdi.stereoType = int.Parse(dic["stereoType"]);

        PlayNewVideoBase(jdi);
        Cinema.VideoPlayer.PreparedPlayVideo(dic);
    }
예제 #7
0
    /// <summary>
    /// DMR调用播放
    /// </summary>
    /// <param name="jVdi"></param>
    public void PlayNewVideo(JVideoDescriptionInfo jVdi)
    {
        CurJVideoInfo = null;
        if (jVdi == null)
        {
            return;
        }

        //Cinema.IsPlayMode = true;
        Cinema.IsPlayOrPauseVideoPlayer = true;
        Cinema.VideoPlayer.Stop();
        PlayNewVideoBase(jVdi);

        PlayVideoAfterAnalyze(-1, jVdi);
    }
예제 #8
0
    void Start()
    {
        Statistics.GetInstance().Start();

        CurJVideoInfo = null;
        CurJImageInfo = null;
        //ClearMovieSubtitle();

        Init();

        StartPlayNewVideo();
        if (Svr.SvrSetting.IsVR9Device)
        {
            Application.targetFrameRate = 30;
        }
    }
예제 #9
0
    public void ResetVariable()
    {
        CurJVideoDscpInfo = null;
        //CurJImageDscpInfo = null;
        IsKeepShowUI        = false;
        IsShowUIForAutoMode = true;
        OldIsMonoShow       = true;
        OldScreenSize       = 0;
        IsEnterPlayer       = false;
        IsShowLoading       = false;
        TPAndVCPUIIsShow    = true;
        IsChangeSize        = false;
        UIIsShow            = false;

        QuadScreenMinSize      = new Vector3(17.91354f, 10.087324f, 1);
        QuadScreenMaxSize      = CinemaSettings.GetInstance().ImaxQuadScreenScale;
        QuadScreenStandardSize = new Vector3(21.91031f, 12.337952f, 1);

        GlobalRunningFunction.Instance.ShowControllerRayLine();
        StopAutoHideUI();
        VideoCtrlPanel.Hide();
    }
예제 #10
0
    void PlayVideoAfterAnalyze(int playIndex, JVideoDescriptionInfo jVideo)
    {
        CurJVideoInfo = null;
        JVideoDescriptionInfo jVdi;

        if (jVideo != null)
        {
            jVdi = jVideo;
        }
        else
        {
            jVdi = PlayerDataControl.GetInstance().GetJVideoDscpInfoByIndex(playIndex);
        }

        if (jVdi == null)
        {
            return;
        }
        CurJVideoInfo = jVdi;
        LogTool.Log("播放索引:" + jVdi.uri + " 播放名称:" + jVdi.name);
        Cinema.VideoPlayer.PreparedPlayVideo(jVdi);
    }
예제 #11
0
    /// <summary>
    /// Set video data source and initialize player.
    /// You must invoked CreatVideoPlayer method before calling it.
    /// </summary>
    /// <param name="url"></param>
    public void PreparedPlayVideo(string url)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        if (VideoPlayerPtr == IntPtr.Zero)
        {
            return;
        }

        // Initialize the struct object for player.
        string name = url.Substring(url.LastIndexOf('/') + 1);
        JVideoDescriptionInfo videoInfo = new JVideoDescriptionInfo(-1, name, url, url, 0, 0, 0, 0, DateTime.Now, true);

        string json = JsonUtility.ToJson(videoInfo);
        IsVideoReady = false;

        // Set data source to initialize player.
        VideoPlayerPtr = SetDataSource(VideoPlayerPtr, json);
        IssuePlayerEvent(VideoPlayerEventBase, RenderCommand.InitializePlayer);

        // You can set the outside subtitle for player.
        //SetSubtitleSource(VideoPlayerPtr, string.Format("0.srt"));
#endif
    }
예제 #12
0
        private void OnFileChosen(DVDFileInfo file, int fileIndex)
        {
            MediaHelpers.MediaType mediaType = MediaHelpers.GetMediaType(file);
            if (mediaType == MediaHelpers.MediaType.Invalid)
            {
                return;
            }
            //CreateMediaPlayer(mediaType);
            //TryPlayMedia(mediaType, file, currentPlayer);
            if (mediaType == MediaHelpers.MediaType.Video)
            {
                JVideoDescriptionInfo jVideo = new JVideoDescriptionInfo(-1, file.fileName, file.fileUrl, file.fileUrl,
                                                                         0, 0, (int)StereoType.ST3D_LR, 0, 0, System.DateTime.Now, null, null);
                PlayerDataControl.GetInstance().SetJVideoDscpInfoByLiveUrl(jVideo);
                PlayerRoot.SetActive(true);
            }
            else
            {
                return;
            }

            mediaSelectorContainer.SetActive(false);
            currentFileIndex = fileIndex;
        }
예제 #13
0
 public void SetJVideoDscpInfoByLiveUrl(JVideoDescriptionInfo liveUrlInfo)
 {
     CurPlayingMode = PlayingURLMode.LiveUrl;
     _liveUrlInfo   = liveUrlInfo;
 }