Пример #1
0
    def test_start_record(self):
        def video_cb(err, code):
            self.failIf(err, "Error while recording")
            if self.counter:
                self.failUnlessEqual(code, camera.EPrepareComplete,
                                     "State is not proper")
            else:
                self.failUnlessEqual(code, camera.EOpenComplete,
                                     "State is not proper")
            self.counter += 1

        def finder_cb(im):
            appuifw.app.body.blit(im)

        self.counter = 0
        video_filename = 'test_video.3gp'
        appuifw.app.body = appuifw.Canvas()
        self.delete_files_if_exist([video_filename], save_path)

        try:
            camera.start_finder(finder_cb)
            camera.start_record(save_path + video_filename, video_cb)
            e32.ao_sleep(5)
            camera.stop_record()
            camera.stop_finder()
        except RuntimeError, e:
            print >> sys.stderr, "Error recording a video :", e
            raise
def videocamera():
    global keyboard

    i = len(os.listdir("E:\\Videos\\"))
    video_savepath = u"E:\\Videos\\vid%d.mp4" % i

    canvas = appuifw.Canvas(event_callback=keyboard.handle_event,
                            redraw_callback=None)
    appuifw.app.body = canvas

    camera.stop_finder()
    camera.start_finder(vf, size=(240, 196))

    recording = False
    running = True
    while running:
        if keyboard.pressed(EScancodeSelect):
            if not recording:
                vid = camera.start_record(
                    video_savepath, video_callback)  #Start recording the video
                recording = True
            else:
                camera.stop_record()  #Stop recording
                videocamera()  #Restart the camera in video mode
        if keyboard.pressed(EScancodeRightSoftkey) and recording:
            camera.stop_record()
            quit()
        appuifw.app.menu = [(u"Exit", quit)]
        e32.ao_yield()
Пример #3
0
def videocamera():
	global keyboard
 
	i=len(os.listdir("E:\\Videos\\"))
	video_savepath=u"E:\\Videos\\vid%d.mp4" % i
 
	canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=None)
	appuifw.app.body=canvas
 
	camera.stop_finder()
	camera.start_finder(vf, size=(240,196))
 
	recording=False
	running=True
	while running:
		if keyboard.pressed(EScancodeSelect):
			if not recording:
				vid=camera.start_record(video_savepath, video_callback)   #Start recording the video
				recording=True
			else:
				camera.stop_record()    #Stop recording
				videocamera()	        #Restart the camera in video mode
		if keyboard.pressed(EScancodeRightSoftkey) and recording:
			camera.stop_record()
			quit()
		appuifw.app.menu=[(u"Exit", quit)]
		e32.ao_yield()
def start_video():
    files=os.listdir(videodir)
    num = len(files) 
    filename = videodir+'pyvideo'+unicode(num+1)+'.3gp'
    canvas.bind(key_codes.EKeySelect, stop_video)
    camera.start_record(filename,video_callback)       
Пример #5
0
def start_video():
    files=os.listdir(videodir)
    num = len(files) 
    filename = videodir+'pyvideo'+unicode(num+1)+'.3gp'
    canvas.bind(key_codes.EKeySelect, stop_video)
    camera.start_record(filename,video_callback)