×
Namespaces

Variants
Actions

Archived:How to record a call using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
CompatibilityArticle
Created: User:Kandyfloss (05 Apr 2008)
Last edited: hamishwillee (08 May 2013)


The below code is used to record a call using PySymbian.


import appuifw
import e32
from key_codes import *
import audio
 
s = audio.Sound.open('C:\\data\\h.amr')
 
class Keyboard(object):
def __init__(self,onevent=lambda:None):
self._keyboard_state={}
self._downs={}
self._onevent=onevent
def handle_event(self,event):
if event['type'] == appuifw.EEventKeyDown:
code=event['scancode']
if not self.is_down(code):
self._downs[code]=self._downs.get(code,0)+1
self._keyboard_state[code]=1
elif event['type'] == appuifw.EEventKeyUp:
self._keyboard_state[event['scancode']]=0
self._onevent()
def is_down(self,scancode):
return self._keyboard_state.get(scancode,0)
def pressed(self,scancode):
if self._downs.get(scancode,0):
self._downs[scancode]-=1
return True
return False
 
keyboard=Keyboard()
 
def quit():
global running, s
running=0
s.close()
appuifw.app.set_exit()
 
running=1
 
appuifw.app.screen='normal'
 
canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=None)
appuifw.app.body=canvas
 
appuifw.app.exit_key_handler=quit
 
while running:
 
if keyboard.pressed(EScancode2):
s.play()
appuifw.note(u"Playing", "info") #Start Playing
 
 
if keyboard.pressed(EScancode3):
s.stop() # Stop recording
appuifw.note(u"Stopped", "info") #Stopped
 
 
if keyboard.pressed(EScancode1):
appuifw.note(u"Recording", "info")
s.record() # Start recording
 
e32.ao_yield()
This page was last modified on 8 May 2013, at 08:14.
98 page views in the last 30 days.
×