Example #1
0
def add_player():
	global g_wav_files
	global g_wav_id
	global g_wav_port
	
	file_name = ""
	status = -1
	wav_id = 0
	
	print "Enter the path of the file player(e.g. /tmp/audio.wav): ",
	file_name = sys.stdin.readline()
	if file_name == "\n": 
		return
	file_name = file_name.replace("\n", "")
	status, wav_id = py_pjsua.player_create(file_name, 0)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error adding file player ", status)
	else:
		g_wav_files.append(file_name)
		if g_wav_id == 0:
			g_wav_id = wav_id
			g_wav_port = py_pjsua.player_get_conf_port(wav_id)
		write_log(3, "File player " + file_name + " added")
Example #2
0
print "py media conf add port status " + ` status ` + " id " + ` id `
if status != 0:
    py_pjsua.perror("py_pjsua", "add port", status)
status = py_pjsua.conf_remove_port(id)
print "py media conf remove port status " + ` status `
if status != 0:
    py_pjsua.perror("py_pjsua", "remove port", status)
status = py_pjsua.conf_connect(id, id)
print "py media conf connect status " + ` status `
if status != 0:
    py_pjsua.perror("py_pjsua", "connect", status)
status = py_pjsua.conf_disconnect(id, id)
print "py media conf disconnect status " + ` status `
if status != 0:
    py_pjsua.perror("py_pjsua", "disconnect", status)
status, id = py_pjsua.player_create("test.wav", 0)
print "py media player create status " + ` status ` + " id " + ` id `
if status != 0:
    py_pjsua.perror("py_pjsua", "player create", status)
c_id = py_pjsua.player_get_conf_port(id)
print "py media player get conf port id " + ` c_id `
status = py_pjsua.player_set_pos(id, 10)
if status != 0:
    py_pjsua.perror("py_pjsua", "player set pos", status)
status = py_pjsua.player_destroy(id)
if status != 0:
    py_pjsua.perror("py_pjsua", "player destroy", status)
status, id = py_pjsua.recorder_create("rec.wav", 0, "None", 1000, 0)
print "py media recorder create status " + ` status ` + " id " + ` id `
if status != 0:
    py_pjsua.perror("py_pjsua", "recorder create", status)
Example #3
0
print "py media conf add port status " + `status` + " id " + `id`
if status != 0 :
	py_pjsua.perror("py_pjsua","add port",status)
status = py_pjsua.conf_remove_port(id)
print "py media conf remove port status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","remove port",status)
status = py_pjsua.conf_connect(id, id)
print "py media conf connect status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","connect",status)
status = py_pjsua.conf_disconnect(id, id)
print "py media conf disconnect status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","disconnect",status)
status, id = py_pjsua.player_create("test.wav", 0)
print "py media player create status " + `status` + " id " + `id`
if status != 0 :
	py_pjsua.perror("py_pjsua","player create",status)
c_id = py_pjsua.player_get_conf_port(id)
print "py media player get conf port id " + `c_id`
status = py_pjsua.player_set_pos(id, 10)
if status != 0 :
	py_pjsua.perror("py_pjsua","player set pos",status)
status = py_pjsua.player_destroy(id)
if status != 0 :
	py_pjsua.perror("py_pjsua","player destroy",status)
status, id = py_pjsua.recorder_create("rec.wav", 0, "None", 1000, 0)
print "py media recorder create status " + `status` + " id " + `id`
if status != 0 :
	py_pjsua.perror("py_pjsua","recorder create",status)