def input_with_timeout(dur, player):

	#function to kill player
	def killit():
		os.kill(os.getpid(), signal.SIGINT)

	#timer with kill function tagged onto end
	t = Timer(dur/1000, killit)
	
	#plays
	player.play()
	try:
		#starts timer
		t.start()
		#awaits user input and acts based on input
		keyboard = raw_input("Enter your next command...")
		while 1:
			if keyboard == "play":
				player.play()
				t.start()
			elif keyboard == "pause":
				player.pause()
				t.sleep()
			elif keyboard == "stop":
				player.stop()
				t.cancel()
				return "stop"
			elif keyboard == "next":
				player.stop()
				t.cancel()
				return "next"
	except KeyboardInterrupt:
		print "Exception thrown"		
		pass
	player.stop()
	t.cancel()
	print "Timer cancelled"
	return