示例#1
0
    def send(self, msg):
        def sendInternal(self, msg):
            yield self.queue.put(msg)

        if msg.type in (Message.RPC, Message.RPC3):
            cmd = Command.fromMessage(msg)
            if cmd.name == 'onStatus' and len(cmd.args) > 0 and hasattr(cmd.args[0], 'code') and cmd.args[
                0].code == 'NetStream.Play.Stop': msg = False  # indicates end of file
        multitask.add(sendInternal(self, msg))
示例#2
0
 def messageReceived(self, msg): # invoked by base class framework to handle a receive message.
     if (msg.type == Message.RPC or msg.type == Message.RPC3) and msg.streamId == 0:
         cmd = Command.fromMessage(msg)
         yield self.queue.put(cmd, timeout=5) # RPC call, must be processed by application within 5 seconds, or will be discarded.
     elif msg.streamId in self.streams: # this has to be a message on the stream
         stream = self.streams[msg.streamId]
         if not stream.client: stream.client = self 
         yield stream.queue.put(msg) # give it to stream
     elif _debug: print 'ignoring stream message for streamId=', msg.streamId
示例#3
0
    def send(self, msg):
        def sendInternal(self, msg):
            yield self.queue.put(msg)

        if msg.type in (Message.RPC, Message.RPC3):
            cmd = Command.fromMessage(msg)
            if cmd.name == 'onStatus' and len(cmd.args) > 0 and hasattr(
                    cmd.args[0],
                    'code') and cmd.args[0].code == 'NetStream.Play.Stop':
                msg = False  # indicates end of file
        multitask.add(sendInternal(self, msg))