Пример #1
0
        public void seek(double position)
        {
            IConnection connection = FluorineContext.Current.Connection;

            if (connection is IStreamCapableConnection)
            {
                IStreamCapableConnection connection2 = connection as IStreamCapableConnection;
                int           currentStreamId        = this.GetCurrentStreamId();
                IClientStream streamById             = connection2.GetStreamById(currentStreamId);
                if ((streamById != null) && (streamById is ISubscriberStream))
                {
                    ISubscriberStream stream2 = streamById as ISubscriberStream;
                    try
                    {
                        stream2.Seek((int)position);
                    }
                    catch (NotSupportedException exception)
                    {
                        StatusASO status = new StatusASO("NetStream.Seek.Failed")
                        {
                            clientid    = currentStreamId,
                            description = "The stream doesn't support seeking.",
                            level       = "error",
                            details     = exception.Message
                        };
                        (connection2 as RtmpConnection).GetChannel((byte)(4 + ((currentStreamId - 1) * 5))).SendStatus(status);
                    }
                }
            }
        }
Пример #2
0
        public void seek(double position)
        {
            IConnection connection = FluorineContext.Current.Connection;

            if (!(connection is IStreamCapableConnection))
            {
                return;
            }
            IStreamCapableConnection streamConnection = connection as IStreamCapableConnection;
            int           streamId = GetCurrentStreamId();
            IClientStream stream   = streamConnection.GetStreamById(streamId);

            if (stream == null || !(stream is ISubscriberStream))
            {
                return;
            }
            ISubscriberStream subscriberStream = stream as ISubscriberStream;

            try
            {
                subscriberStream.Seek((int)position);
            }
            catch (NotSupportedException ex)
            {
                StatusASO seekFailed = new StatusASO(StatusASO.NS_SEEK_FAILED);
                seekFailed.clientid    = streamId;
                seekFailed.description = "The stream doesn't support seeking.";
                seekFailed.level       = "error";
                seekFailed.details     = ex.Message;
                // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
                channel.SendStatus(seekFailed);
            }
        }
Пример #3
0
        private void SendNSFailed(RtmpConnection connection, string description, string name, int streamId)
        {
            StatusASO status = new StatusASO("NetStream.Failed")
            {
                clientid    = streamId,
                description = description,
                details     = name,
                level       = "error"
            };

            connection.GetChannel((byte)(4 + ((streamId - 1) * 5))).SendStatus(status);
        }
Пример #4
0
        private void SendNSFailed(RtmpConnection connection, string description, string name, int streamId)
        {
            StatusASO failed = new StatusASO(StatusASO.NS_FAILED);

            failed.clientid    = streamId;
            failed.description = description;
            failed.details     = name;
            failed.level       = "error";
            // FIXME: there should be a direct way to send the status
            RtmpChannel channel = connection.GetChannel((byte)(4 + ((streamId - 1) * 5)));

            channel.SendStatus(failed);
        }
Пример #5
0
        /// <summary>
        /// Sends publish start notifications.
        /// </summary>
        private void SendPublishStartNotify()
        {
            StatusASO publishStatus = new StatusASO(StatusASO.NS_PUBLISH_START);

            publishStatus.clientid = this.StreamId;
            publishStatus.details  = this.PublishedName;
            StatusMessage startMsg = new StatusMessage();

            startMsg.body = publishStatus;
            try {
                _connMsgOut.PushMessage(startMsg);
            } catch (System.IO.IOException ex) {
                log.Error("Error while pushing message.", ex);
            }
        }
Пример #6
0
        /// <summary>
        /// Sends record stop notifications.
        /// </summary>
        private void SendRecordStopNotify()
        {
            StatusASO stopStatus = new StatusASO(StatusASO.NS_RECORD_STOP);

            stopStatus.clientid = this.StreamId;
            stopStatus.details  = this.PublishedName;

            StatusMessage startMsg = new StatusMessage();

            startMsg.body = stopStatus;
            try {
                _connMsgOut.PushMessage(startMsg);
            } catch (System.IO.IOException ex) {
                log.Error("Error while pushing message.", ex);
            }
        }
Пример #7
0
        /// <summary>
        /// Sends record failed notifications.
        /// </summary>
        /// <param name="reason"></param>
        private void SendRecordFailedNotify(string reason)
        {
            StatusASO failedStatus = new StatusASO(StatusASO.NS_RECORD_FAILED);

            failedStatus.level       = StatusASO.ERROR;
            failedStatus.clientid    = this.StreamId;
            failedStatus.details     = this.PublishedName;
            failedStatus.description = reason;

            StatusMessage failedMsg = new StatusMessage();

            failedMsg.body = failedStatus;
            try {
                _connMsgOut.PushMessage(failedMsg);
            } catch (IOException ex) {
                log.Error("Error while pushing message.", ex);
            }
        }
Пример #8
0
        private void SendRecordStopNotify()
        {
            StatusASO saso = new StatusASO("NetStream.Record.Stop")
            {
                clientid = base.StreamId,
                details  = this.PublishedName
            };
            StatusMessage message = new StatusMessage {
                body = saso
            };

            try
            {
                this._connMsgOut.PushMessage(message);
            }
            catch (IOException exception)
            {
                log.Error("Error while pushing message.", exception);
            }
        }
Пример #9
0
        private void SendRecordFailedNotify(string reason)
        {
            StatusASO saso = new StatusASO("NetStream.Record.Failed")
            {
                level       = "error",
                clientid    = base.StreamId,
                details     = this.PublishedName,
                description = reason
            };
            StatusMessage message = new StatusMessage {
                body = saso
            };

            try
            {
                this._connMsgOut.PushMessage(message);
            }
            catch (IOException exception)
            {
                log.Error("Error while pushing message.", exception);
            }
        }
Пример #10
0
        /// <summary>
        /// Sends record stop notifications.
        /// </summary>
        private void SendRecordStopNotify()
        {
            StatusASO stopStatus = new StatusASO(StatusASO.NS_RECORD_STOP);
            stopStatus.clientid = this.StreamId;
            stopStatus.details = this.PublishedName;

            StatusMessage startMsg = new StatusMessage();
            startMsg.body = stopStatus;
            try
            {
                _connMsgOut.PushMessage(startMsg);
            }
            catch (System.IO.IOException ex)
            {
                log.Error("Error while pushing message.", ex);
            }
        }
Пример #11
0
        /// <summary>
        /// Insufficient bandwidth notification
        /// </summary>
        /// <param name="item"></param>
        private void SendInsufficientBandwidthStatus(IPlayItem item)
        {
            StatusASO insufficientBW = new StatusASO(StatusASO.NS_PLAY_INSUFFICIENT_BW);
            insufficientBW.clientid = this.StreamId;
            insufficientBW.level = StatusASO.WARNING;
            insufficientBW.details = item.Name;
            insufficientBW.description = "Data is playing behind the normal speed.";

            StatusMessage insufficientBWMsg = new StatusMessage();
            insufficientBWMsg.body = insufficientBW;
            DoPushMessage(insufficientBWMsg);
        }
Пример #12
0
 /// <summary>
 /// Sends publish start notifications.
 /// </summary>
 private void SendPublishStartNotify()
 {
     StatusASO publishStatus = new StatusASO(StatusASO.NS_PUBLISH_START);
     publishStatus.clientid = this.StreamId;
     publishStatus.details = this.PublishedName;
     StatusMessage startMsg = new StatusMessage();
     startMsg.body = publishStatus;
     try
     {
         _connMsgOut.PushMessage(startMsg);
     }
     catch(System.IO.IOException ex)
     {
         log.Error("Error while pushing message.", ex);
     }
 }
Пример #13
0
        /// <summary>
        /// Send unpublished status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendUnpublishedStatus(IPlayItem item)
        {
            StatusASO unpublished = new StatusASO(StatusASO.NS_PLAY_UNPUBLISHNOTIFY);
            unpublished.clientid = this.StreamId;
            unpublished.details = item.Name;

            StatusMessage unpublishedMsg = new StatusMessage();
            unpublishedMsg.body = unpublished;
            DoPushMessage(unpublishedMsg);
        }
Пример #14
0
        /// <summary>
        /// Stream not found status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendStreamNotFoundStatus(IPlayItem item)
        {
            StatusASO notFound = new StatusASO(StatusASO.NS_PLAY_STREAMNOTFOUND);
            notFound.clientid = this.StreamId;
            notFound.level = StatusASO.ERROR;
            notFound.details = item.Name;

            StatusMessage notFoundMsg = new StatusMessage();
            notFoundMsg.body = notFound;
            DoPushMessage(notFoundMsg);
        }
Пример #15
0
 private void SendNSFailed(RtmpConnection connection, string description, string name, int streamId)
 {
     StatusASO failed = new StatusASO(StatusASO.NS_FAILED);
     failed.clientid = streamId;
     failed.description = description;
     failed.details = name;
     failed.level = "error";
     // FIXME: there should be a direct way to send the status
     RtmpChannel channel = connection.GetChannel((byte)(4 + ((streamId - 1) * 5)));
     channel.SendStatus(failed);
 }
Пример #16
0
        /// <summary>
        /// Send resume status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendResumeStatus(IPlayItem item)
        {
            StatusASO resume = new StatusASO(StatusASO.NS_UNPAUSE_NOTIFY);
            resume.clientid = this.StreamId;
            resume.details = item.Name;

            StatusMessage resumeMsg = new StatusMessage();
            resumeMsg.body = resume;
            DoPushMessage(resumeMsg);
        }
Пример #17
0
        /// <summary>
        /// Send playback stoppage status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendStopStatus(IPlayItem item)
        {
            StatusASO stop = new StatusASO(StatusASO.NS_PLAY_STOP);
            stop.clientid = this.StreamId;
            stop.description = "Stopped playing " + item.Name + ".";
            stop.details = item.Name;

            StatusMessage stopMsg = new StatusMessage();
            stopMsg.body = stop;
            DoPushMessage(stopMsg);
        }
Пример #18
0
 /// <summary>
 /// Send seek status notification
 /// </summary>
 /// <param name="item"></param>
 /// <param name="position"></param>
 private void SendSeekStatus(IPlayItem item, int position)
 {
     StatusASO seek = new StatusASO(StatusASO.NS_SEEK_NOTIFY);
     seek.clientid = this.StreamId;
     seek.details = item.Name;
     seek.description = "Seeking " + position + " (stream ID: " + this.StreamId + ").";
     StatusMessage seekMsg = new StatusMessage();
     seekMsg.body = seek;
     DoPushMessage(seekMsg);
 }
Пример #19
0
 /// <summary>
 /// Send reset status for item
 /// </summary>
 /// <param name="item"></param>
 private void SendResetStatus(IPlayItem item)
 {
     StatusASO reset = new StatusASO(StatusASO.NS_PLAY_RESET);
     reset.clientid = this.StreamId;
     reset.details = item.Name;
     reset.description = "Playing and resetting " + item.Name + '.';
     StatusMessage resetMsg = new StatusMessage();
     resetMsg.body = reset;
     DoPushMessage(resetMsg);
 }
Пример #20
0
        /// <summary>
        /// Send playback start status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendStartStatus(IPlayItem item)
        {
            StatusASO start = new StatusASO(StatusASO.NS_PLAY_START);
            start.clientid = this.StreamId;
            start.details = item.Name;
            start.description = "Started playing " + item.Name + '.';

            StatusMessage startMsg = new StatusMessage();
            startMsg.body = start;
            DoPushMessage(startMsg);
        }
Пример #21
0
        public void publish(string name, string mode)
        {
            IConnection connection = FluorineContext.Current.Connection;

            if (connection is IStreamCapableConnection)
            {
                IStreamCapableConnection connection2 = connection as IStreamCapableConnection;
                IScope scope           = connection.Scope;
                int    currentStreamId = this.GetCurrentStreamId();
                if ((name == null) || string.Empty.Equals(name))
                {
                    this.SendNSFailed(connection2 as RtmpConnection, "The stream name may not be empty.", name, currentStreamId);
                }
                else
                {
                    IStreamSecurityService scopeService = ScopeUtils.GetScopeService(scope, typeof(IStreamSecurityService)) as IStreamSecurityService;
                    if (scopeService != null)
                    {
                        IEnumerator streamPublishSecurity = scopeService.GetStreamPublishSecurity();
                        while (streamPublishSecurity.MoveNext())
                        {
                            IStreamPublishSecurity current = streamPublishSecurity.Current as IStreamPublishSecurity;
                            if (!current.IsPublishAllowed(scope, name, mode))
                            {
                                this.SendNSFailed(connection2 as RtmpConnection, "You are not allowed to publish the stream.", name, currentStreamId);
                                return;
                            }
                        }
                    }
                    IBroadcastScope broadcastScope = this.GetBroadcastScope(scope, name);
                    if ((broadcastScope != null) && (broadcastScope.GetProviders().Count > 0))
                    {
                        StatusASO status = new StatusASO("NetStream.Publish.BadName")
                        {
                            clientid = currentStreamId,
                            details  = name,
                            level    = "error"
                        };
                        (connection2 as RtmpConnection).GetChannel((byte)(4 + ((currentStreamId - 1) * 5))).SendStatus(status);
                    }
                    else
                    {
                        IClientStream streamById = connection2.GetStreamById(currentStreamId);
                        if ((streamById == null) || (streamById is IClientBroadcastStream))
                        {
                            bool flag = false;
                            if (streamById == null)
                            {
                                streamById = connection2.NewBroadcastStream(currentStreamId);
                                flag       = true;
                            }
                            IClientBroadcastStream broadcastStream = streamById as IClientBroadcastStream;
                            try
                            {
                                broadcastStream.PublishedName = name;
                                IScopeContext    context  = connection.Scope.Context;
                                IProviderService service2 = ScopeUtils.GetScopeService(connection.Scope, typeof(IProviderService)) as IProviderService;
                                if (service2.RegisterBroadcastStream(connection.Scope, name, broadcastStream))
                                {
                                    broadcastScope = this.GetBroadcastScope(connection.Scope, name);
                                    broadcastScope.SetAttribute("_transient_publishing_stream", broadcastStream);
                                    if (connection is BaseConnection)
                                    {
                                        (connection as BaseConnection).RegisterBasicScope(broadcastScope);
                                    }
                                }
                                if ("record".Equals(mode))
                                {
                                    broadcastStream.Start();
                                    broadcastStream.SaveAs(name, false);
                                }
                                else if ("append".Equals(mode))
                                {
                                    broadcastStream.Start();
                                    broadcastStream.SaveAs(name, true);
                                }
                                else if ("live".Equals(mode))
                                {
                                    broadcastStream.Start();
                                }
                                broadcastStream.StartPublishing();
                            }
                            catch (IOException exception)
                            {
                                StatusASO saso2 = new StatusASO("NetStream.Record.NoAccess")
                                {
                                    clientid    = currentStreamId,
                                    description = "The file could not be created/written to." + exception.Message,
                                    details     = name,
                                    level       = "error"
                                };
                                (connection2 as RtmpConnection).GetChannel((byte)(4 + ((currentStreamId - 1) * 5))).SendStatus(saso2);
                                broadcastStream.Close();
                                if (flag)
                                {
                                    connection2.DeleteStreamById(currentStreamId);
                                }
                            }
                            catch (Exception exception2)
                            {
                                log.Warn("Publish caught exception", exception2);
                            }
                        }
                    }
                }
            }
        }
Пример #22
0
        public void publish(string name, string mode)
        {
            IConnection connection = FluorineContext.Current.Connection;

            if (!(connection is IStreamCapableConnection))
            {
                return;
            }
            IStreamCapableConnection streamConnection = connection as IStreamCapableConnection;
            IScope scope    = connection.Scope;
            int    streamId = GetCurrentStreamId();

            if (name == null || string.Empty.Equals(name))
            {
                SendNSFailed(streamConnection as RtmpConnection, "The stream name may not be empty.", name, streamId);
                return;
            }

            IStreamSecurityService security = ScopeUtils.GetScopeService(scope, typeof(IStreamSecurityService)) as IStreamSecurityService;

            if (security != null)
            {
                IEnumerator handlers = security.GetStreamPublishSecurity();
                while (handlers.MoveNext())
                {
                    IStreamPublishSecurity handler = handlers.Current as IStreamPublishSecurity;
                    if (!handler.IsPublishAllowed(scope, name, mode))
                    {
                        SendNSFailed(streamConnection as RtmpConnection, "You are not allowed to publish the stream.", name, streamId);
                        return;
                    }
                }
            }
            IBroadcastScope bsScope = GetBroadcastScope(scope, name);

            if (bsScope != null && bsScope.GetProviders().Count > 0)
            {
                // Another stream with that name is already published.
                StatusASO badName = new StatusASO(StatusASO.NS_PUBLISH_BADNAME);
                badName.clientid = streamId;
                badName.details  = name;
                badName.level    = "error";
                // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
                channel.SendStatus(badName);
                return;
            }
            IClientStream stream = streamConnection.GetStreamById(streamId);

            if (stream != null && !(stream is IClientBroadcastStream))
            {
                return;
            }
            bool created = false;

            if (stream == null)
            {
                stream  = streamConnection.NewBroadcastStream(streamId);
                created = true;
            }
            IClientBroadcastStream bs = stream as IClientBroadcastStream;

            try
            {
                bs.PublishedName = name;
                IScopeContext context = connection.Scope.Context;
                //IProviderService providerService = (IProviderService)context.getBean(IProviderService.BEAN_NAME);
                IProviderService providerService = ScopeUtils.GetScopeService(connection.Scope, typeof(IProviderService)) as IProviderService;
                // TODO handle registration failure
                if (providerService.RegisterBroadcastStream(connection.Scope, name, bs))
                {
                    bsScope = GetBroadcastScope(connection.Scope, name);
                    bsScope.SetAttribute(Constants.BroadcastScopeStreamAttribute, bs);
                    if (connection is BaseConnection)
                    {
                        (connection as BaseConnection).RegisterBasicScope(bsScope);
                    }
                }
                if (Constants.ClientStreamModeRecord.Equals(mode))
                {
                    bs.Start();
                    bs.SaveAs(name, false);
                }
                else if (Constants.ClientStreamModeAppend.Equals(mode))
                {
                    bs.Start();
                    bs.SaveAs(name, true);
                }
                else if (Constants.ClientStreamModeLive.Equals(mode))
                {
                    bs.Start();
                }
                bs.StartPublishing();
            }
            catch (System.IO.IOException ex)
            {
                StatusASO accessDenied = new StatusASO(StatusASO.NS_RECORD_NOACCESS);
                accessDenied.clientid    = streamId;
                accessDenied.description = "The file could not be created/written to." + ex.Message;
                accessDenied.details     = name;
                accessDenied.level       = "error";
                // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
                channel.SendStatus(accessDenied);
                bs.Close();
                if (created)
                {
                    streamConnection.DeleteStreamById(streamId);
                }
            }
            catch (Exception ex)
            {
                log.Warn("Publish caught exception", ex);
            }
        }
Пример #23
0
        public void publish(string name, string mode)
        {
	        IConnection connection = FluorineContext.Current.Connection;
	        if (!(connection is IStreamCapableConnection)) 
		        return;
            IStreamCapableConnection streamConnection = connection as IStreamCapableConnection;
		    IScope scope = connection.Scope;
		    int streamId = GetCurrentStreamId();
		    if (name == null || string.Empty.Equals(name)) 
            {
                SendNSFailed(streamConnection as RtmpConnection, "The stream name may not be empty.", name, streamId);
			    return;
		    }

		    IStreamSecurityService security = ScopeUtils.GetScopeService(scope, typeof(IStreamSecurityService)) as IStreamSecurityService;
		    if (security != null) 
            {
			    IEnumerator handlers = security.GetStreamPublishSecurity();
			    while(handlers.MoveNext())
                {
                    IStreamPublishSecurity handler = handlers.Current as IStreamPublishSecurity;
				    if (!handler.IsPublishAllowed(scope, name, mode)) 
                    {
                        SendNSFailed(streamConnection as RtmpConnection, "You are not allowed to publish the stream.", name, streamId);
					    return;
				    }
			    }
		    }
		    IBroadcastScope bsScope = GetBroadcastScope(scope, name);
		    if (bsScope != null && bsScope.GetProviders().Count > 0) 
            {
			    // Another stream with that name is already published.
			    StatusASO badName = new StatusASO(StatusASO.NS_PUBLISH_BADNAME);
			    badName.clientid = streamId;
			    badName.details = name;
			    badName.level = "error";
			    // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
			    channel.SendStatus(badName);
			    return;
		    }
		    IClientStream stream = streamConnection.GetStreamById(streamId);
		    if (stream != null && !(stream is IClientBroadcastStream))
			    return;
		    bool created = false;
		    if (stream == null) 
            {
			    stream = streamConnection.NewBroadcastStream(streamId);
			    created = true;
		    }
		    IClientBroadcastStream bs = stream as IClientBroadcastStream;
		    try 
            {
			    bs.PublishedName = name;
			    IScopeContext context = connection.Scope.Context;
			    //IProviderService providerService = (IProviderService)context.getBean(IProviderService.BEAN_NAME);
                IProviderService providerService = ScopeUtils.GetScopeService(connection.Scope, typeof(IProviderService)) as IProviderService;
                // TODO handle registration failure
			    if (providerService.RegisterBroadcastStream(connection.Scope, name, bs)) 
                {
				    bsScope = GetBroadcastScope(connection.Scope, name);
                    bsScope.SetAttribute(Constants.BroadcastScopeStreamAttribute, bs);
				    if (connection is BaseConnection) 
                    {
                        (connection as BaseConnection).RegisterBasicScope(bsScope);
				    }
			    }
			    if (Constants.ClientStreamModeRecord.Equals(mode)) 
                {
				    bs.Start();
				    bs.SaveAs(name, false);
                }
                else if (Constants.ClientStreamModeAppend.Equals(mode)) 
                {
				    bs.Start();
				    bs.SaveAs(name, true);
			    }
                else if (Constants.ClientStreamModeLive.Equals(mode)) 
                {
				    bs.Start();
			    }
			    bs.StartPublishing();
            } 
            catch (System.IO.IOException ex)
            {
                StatusASO accessDenied = new StatusASO(StatusASO.NS_RECORD_NOACCESS);
			    accessDenied.clientid = streamId;
			    accessDenied.description = "The file could not be created/written to." + ex.Message;
			    accessDenied.details = name;
			    accessDenied.level = "error";
			    // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
			    channel.SendStatus(accessDenied);
			    bs.Close();
			    if (created)
				    streamConnection.DeleteStreamById(streamId);
		     } 
            catch (Exception ex)
            {
			    log.Warn("Publish caught exception", ex);
		    }
        }
Пример #24
0
        /// <summary>
        /// Sends record failed notifications.
        /// </summary>
        /// <param name="reason"></param>
        private void SendRecordFailedNotify(string reason)
        {
            StatusASO failedStatus = new StatusASO(StatusASO.NS_RECORD_FAILED);
            failedStatus.level = StatusASO.ERROR;
            failedStatus.clientid = this.StreamId;
            failedStatus.details = this.PublishedName;
            failedStatus.description = reason;

            StatusMessage failedMsg = new StatusMessage();
            failedMsg.body = failedStatus;
            try
            {
                _connMsgOut.PushMessage(failedMsg);
            }
            catch (IOException ex)
            {
                log.Error("Error while pushing message.", ex);
            }
        }
Пример #25
0
        /// <summary>
        /// Send pause status notification
        /// </summary>
        /// <param name="item"></param>
        private void SendPauseStatus(IPlayItem item)
        {
            StatusASO pause = new StatusASO(StatusASO.NS_PAUSE_NOTIFY);
            pause.clientid = this.StreamId;
            pause.details = item.Name;

            StatusMessage pauseMsg = new StatusMessage();
            pauseMsg.body = pause;
            DoPushMessage(pauseMsg);
        }
Пример #26
0
 public override void ConnectionClosed(RtmpConnection connection)
 {
     base.ConnectionClosed(connection);
     _netConnection.RaiseNetStatus(StatusASO.GetStatusObject(StatusASO.NC_CONNECT_CLOSED, _netConnection.ObjectEncoding));
     _netConnection.RaiseDisconnect();
 }
Пример #27
0
        public void seek(double position)
        {
		    IConnection connection = FluorineContext.Current.Connection;
		    if (!(connection is IStreamCapableConnection))
			    return;		
		    IStreamCapableConnection streamConnection = connection as IStreamCapableConnection;
		    int streamId = GetCurrentStreamId();
		    IClientStream stream = streamConnection.GetStreamById(streamId);
		    if (stream == null || !(stream is ISubscriberStream))
			    return;
            ISubscriberStream subscriberStream = stream as ISubscriberStream;
		    try 
            {
			    subscriberStream.Seek((int)position);
		    } 
            catch (NotSupportedException ex) 
            {
                StatusASO seekFailed = new StatusASO(StatusASO.NS_SEEK_FAILED);
			    seekFailed.clientid = streamId;
			    seekFailed.description = "The stream doesn't support seeking.";
			    seekFailed.level = "error";
                seekFailed.details = ex.Message;
			    // FIXME: there should be a direct way to send the status
                RtmpChannel channel = (streamConnection as RtmpConnection).GetChannel((byte)(4 + ((streamId - 1) * 5)));
			    channel.SendStatus(seekFailed);
		    }
        }