Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        public Player()
        {
            NativePlayer.Create(out _handle).ThrowIfFailed(null, "Failed to create player");

            Debug.Assert(_handle != null);

            Initialize();
        }
Example #2
0
        private static void GetSupportedTypes()
        {
            if (_supportedAudioFormats == null && _supportedVideoFormats == null)
            {
                PlayerHandle _playerHandle;
                IntPtr       _handle;

                NativePlayer.Create(out _playerHandle).ThrowIfFailed(null, "Failed to create player");
                _handle = _playerHandle.DangerousGetHandle();
                Debug.Assert(_handle != IntPtr.Zero);

                try
                {
                    _supportedAudioFormats = new List <MediaFormatAudioMimeType>();
                    _supportedVideoFormats = new List <MediaFormatVideoMimeType>();

                    NativePlayer.SupportedMediaFormatCallback callback = (int format, IntPtr userData) =>
                    {
                        if (Enum.IsDefined(typeof(MediaFormatAudioMimeType), format))
                        {
                            Log.Debug(PlayerLog.Tag, "supported audio : " + ((MediaFormatAudioMimeType)format).ToString());
                            _supportedAudioFormats.Add((MediaFormatAudioMimeType)format);
                        }
                        else if (Enum.IsDefined(typeof(MediaFormatVideoMimeType), format))
                        {
                            Log.Debug(PlayerLog.Tag, "supported video : " + ((MediaFormatVideoMimeType)format).ToString());
                            _supportedVideoFormats.Add((MediaFormatVideoMimeType)format);
                        }
                        else
                        {
                            Log.Debug(PlayerLog.Tag, "skipped : " + format.ToString());
                        }

                        return(true);
                    };

                    NativePlayer.SupportedMediaStreamFormat(_handle, callback, IntPtr.Zero).
                    ThrowIfFailed(null, "Failed to get the list");
                }
                finally
                {
                    _playerHandle.Dispose();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        public Player()
        {
            NativePlayer.Create(out _handle).ThrowIfFailed(null, "Failed to create player");

            Debug.Assert(_handle != null);

            if (Features.IsSupported(PlayerFeatures.AudioEffect))
            {
                _audioEffect = new AudioEffect(this);
            }

            if (Features.IsSupported(PlayerFeatures.RawVideo))
            {
                RegisterVideoFrameDecodedCallback();
            }

            DisplaySettings = PlayerDisplaySettings.Create(this);
        }