Пример #1
0
        /// <summary>
        /// Enqueues a play workitem for the given mediaitem.
        /// </summary>
        /// <param name="locator">Resource locator of the to-be-played item.</param>
        /// <param name="mimeType">Mime type of the media item to be played, if given. May be <c>null</c>.</param>
        /// <param name="mediaItemTitle">Title of the media item to be played.</param>
        /// <remarks>
        /// The workitem will actually be executed on the controller's mainthread.
        /// </remarks>
        public void SetMediaItemLocator(IResourceLocator locator, string mimeType, string mediaItemTitle)
        {
            if (_externalState != PlayerState.Stopped)
            {
                Stop();
            }
            IInputSource inputSource = _inputSourceFactory.CreateInputSource(locator, mimeType);

            if (inputSource == null)
            {
                ServiceRegistration.Get <ILogger>().Warn("Unable to play '{0}'", locator);
                return;
            }
            _mediaItemTitle = mediaItemTitle;
            _externalState  = PlayerState.Active;
            _controller.MoveToNextItem_Async(inputSource, StartTime.AtOnce);
        }