コード例 #1
0
        /// <summary>Plays the passed <see cref="PlayResource"/></summary>
        /// <param name="invoker">The invoker of this resource. Used for responses and association.</param>
        /// <param name="play">The associated resource type string to a factory.</param>
        /// <param name="meta">Allows overriding certain settings for the resource.</param>
        /// <returns>Ok if successful, or an error message otherwise.</returns>
        public E <LocalStr> Play(InvokerData invoker, PlayResource play, MetaData meta)
        {
            if (meta.From != PlaySource.FromPlaylist)
            {
                meta.ResourceOwnerUid = invoker.ClientUid;
            }

            var sourceLink = ResourceFactoryManager.RestoreLink(play.BaseData);
            var playInfo   = new PlayInfoEventArgs(invoker, play, meta, sourceLink);

            BeforeResourceStarted?.Invoke(this, playInfo);

            var result = StartResource(play, meta);

            if (!result)
            {
                return(result);
            }

            CurrentPlayData = playInfo;             // TODO meta as readonly
            AfterResourceStarted?.Invoke(this, playInfo);

            return(R.Ok);
        }