Skip to content

Instantly share code, notes, and snippets.

@notnola

notnola/main.py Secret

Created February 2, 2015 21:21
Show Gist options
  • Save notnola/c92554e3c97e49c429d3 to your computer and use it in GitHub Desktop.
Save notnola/c92554e3c97e49c429d3 to your computer and use it in GitHub Desktop.
def createStream(self, playpath): #todo - Rework this Funtions
d = "cam/" + self.room + "/"
if not os.path.exists(d):
os.makedirs(d)
pass
try:
self.output_file = open(d + playpath + ".flv", 'wb')
except:
print("Cannot open output file.\n Please check the output_file_path\n. Aborting.")
self.connection.set_option(key="live", value='True')
librtmp_binding.RTMP_SendCreateStream(self.connection.rtmp)
self.connection.set_option(key="playpath", value="7687")
#self.connection.call1("play", u"" + "7687", transaction_id=0)
self.stream = self.connection.create_stream()
while True:
result = self.stream.read(1024)
self.output_file.write(result)
if result == 0:
break
self.output_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment