Beispiel #1
0
        /// <summary>
        /// Play a specific IPlayItem.
        /// The strategy for now is VOD first, Live second.
        /// </summary>
        /// <param name="item">Item to play</param>
        protected void Play(IPlayItem item)
        {
            // Return if already playing
            if (_state != State.STOPPED)
            {
                return;
            }
            // Assume this is not live stream
            bool             isLive          = false;
            IProviderService providerService = ScopeUtils.GetScopeService(this.Scope, typeof(IProviderService)) as IProviderService;

            _msgIn = providerService.GetVODProviderInput(this.Scope, item.Name);
            if (_msgIn == null)
            {
                _msgIn = providerService.GetLiveProviderInput(this.Scope, item.Name, true);
                isLive = true;
            }
            if (_msgIn == null)
            {
                log.Warn("Can't get both VOD and Live input from providerService");
                return;
            }
            _state       = State.PLAYING;
            _currentItem = item;
            SendResetMessage();
            _msgIn.Subscribe(this, null);
            if (isLive)
            {
                if (item.Length >= 0)
                {
                    PlayItemScheduledJob job = new PlayItemScheduledJob(this);
                    _liveJobName = _schedulingService.AddScheduledOnceJob(item.Length, job);
                }
            }
            else
            {
                long start = item.Start;
                if (start < 0)
                {
                    start = 0;
                }
                SendVODInitCM(_msgIn, (int)start);
                StartBroadcastVOD();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Play a specific IPlayItem.
 /// The strategy for now is VOD first, Live second.
 /// </summary>
 /// <param name="item">Item to play</param>
 protected void Play(IPlayItem item)
 {
     // Return if already playing
     if (_state != State.STOPPED)
         return;
     // Assume this is not live stream
     bool isLive = false;
     IProviderService providerService = ScopeUtils.GetScopeService(this.Scope, typeof(IProviderService)) as IProviderService;
     _msgIn = providerService.GetVODProviderInput(this.Scope, item.Name);
     if (_msgIn == null)
     {
         _msgIn = providerService.GetLiveProviderInput(this.Scope, item.Name, true);
         isLive = true;
     }
     if (_msgIn == null)
     {
         log.Warn("Can't get both VOD and Live input from providerService");
         return;
     }
     _state = State.PLAYING;
     _currentItem = item;
     SendResetMessage();
     _msgIn.Subscribe(this, null);
     if (isLive)
     {
         if (item.Length >= 0)
         {
             PlayItemScheduledJob job = new PlayItemScheduledJob(this);
             _liveJobName = _schedulingService.AddScheduledOnceJob(item.Length, job);
         }
     }
     else
     {
         long start = item.Start;
         if (start < 0)
             start = 0;
         SendVODInitCM(_msgIn, (int)start);
         StartBroadcastVOD();
     }
 }