public void Setup(BaseMediaPlayer player)
        {
            BasePhotoPlayer photoPlayer = player as BasePhotoPlayer;

            gameObject.SetActive(photoPlayer != null);
            timer.enabled = false;
        }
        private static bool TryPlayMedia(MediaHelpers.MediaType mediaType, FileInfo file, BaseMediaPlayer player)
        {
            switch (mediaType)
            {
            case MediaHelpers.MediaType.Video:
                BaseVideoPlayer videoPlayer = player as BaseVideoPlayer;
                if (videoPlayer != null)
                {
                    PlayOptions options = new PlayOptions();
                    options.Path = PATH_PREFIX + file.FullName;
                    options.Type = BaseVideoPlayer.VideoType.Other;
                    videoPlayer.Play(options);
                    return(true);
                }
                break;

            case MediaHelpers.MediaType.Photo:
                BasePhotoPlayer photoPlayer = player as BasePhotoPlayer;
                if (photoPlayer != null)
                {
                    photoPlayer.ShowPhoto(file);
                    return(true);
                }
                break;

            default:
                Debug.LogError("Invalid Media Type.");
                break;
            }

            return(false);
        }
示例#3
0
        protected override void DetectInternal()
        {
            BasePhotoPlayer photoPlayer = MediaPlayer as BasePhotoPlayer;

            if (photoPlayer == null)
            {
                Debug.LogError("Can't detect format, MediaPlayer must be a BasePhotoPlayer.");
                CompleteDetection(null);
                return;
            }

            AnalyzeImage(photoPlayer.PhotoTexture, OnAnalyzeImage);
        }
        private void CreateMediaPlayer(MediaHelpers.MediaType mediaType)
        {
            DestroyMediaPlayer();

            switch (mediaType)
            {
            case MediaHelpers.MediaType.Video:
                currentPlayerObject = GameObject.Instantiate(videoPlayerPrefab);
                BaseVideoPlayer videoPlayer = currentPlayerObject.GetComponentInChildren <BaseVideoPlayer>();
                currentPlayer = videoPlayer;
                break;

            case MediaHelpers.MediaType.Photo:
                currentPlayerObject = GameObject.Instantiate(photoPlayerPrefab);
                BasePhotoPlayer photoPlayer = currentPlayerObject.GetComponentInChildren <BasePhotoPlayer>();
                currentPlayer = photoPlayer;
                break;

            default:
                Debug.LogError("Invalid Media Type.");
                break;
            }
        }