Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- A port of the main.asc from the live application included in FMS's sample
- applications.
- """
- import os.path
- import uuid
- import sys
- import urllib
- from twisted.python import log
- from rtmpy import server
- class Client(server.Client):
- """
- Lets you handle each user, or client, connection to an application
- instance. The server automatically creates a Client object when a user
- connects to an application; the object is destroyed when the user
- disconnects from the application.
- @note: The functions in this class are just copies from live/main.asc -
- they don't do anything important (it seems).
- """
- def FCPublish(self, streamname):
- """
- Called by FME when publishing a stream. We make sure that an
- L{FLVWriter} is subscribed to the correct streamname.
- Note that the method name is case-sensitive.
- @param streamname: The name of the stream.
- @type streamname: C{str}
- """
- self.call('onFCPublish', {
- 'code': 'NetStream.Publish.Start',
- 'description': streamname
- })
- def FCUnpublish(self, streamname):
- """
- Called by FME when unpublishing a stream.
- Note that the method name is case-sensitive.
- @param streamname: The name of the stream.
- @type streamname: C{str}
- """
- self.call('onFCPublish', {
- 'code': 'NetStream.Unpublish.Success',
- 'description': streamname
- })
- def checkBandwidth(self):
- """
- """
- self.call('onBWDone')
- class LiveStreamingApplication(server.Application):
- """
- """
- client = Client
- if __name__ == '__main__:
- from twisted.internet import reactor
- app = LiveStreamingApplication()
- reactor.listenTCP(1935, server.ServerFactory({
- 'live': app
- }))
Add Comment
Please, Sign In to add comment