本文へスキップ

Kwik App Design Book: 28 Advanced Recording Sample


http://www.kwiksher.com/tutorials/Multi/Advanced_Recording_Sample.zip

This tutorial describes how to record user's voice.
  • Record button, Play button and Delete button are displayed.
  • User press Record button, then 3 sec count down starts before recording begins.
  • Recording begins for X secounds and X secounds count down starts again to let user know remaing recording time.


  • You will know how to make actions in Kwik panel to interacte with the buttons.

    Overview
  • action_hide_all hides all buttons, starting counter, recording sec counter.
  • isRecordedData variable is a flag which tells Record button to show or Play/Delete buttons to show
  • Record button starts startingCount countdown. When the countdown ends, it triggers act_hide_starting
  • act_hide_starting starts recodingSec countdown and calls "myrecord.lua" as external code. When the countdown ends, it triggers act_hide_recording.
  • act_hide_recording stops recording and shows Play/Delete button
  • Play button calls extenal code "myplay.lua"
  • Delete button justs show YES/NO buttons
  • Yes button to call "mydelete.lua". No buttons does nothing to hide YES/NO layers
  • act_hide_starting


    when user press Record button 3 sec countdown starts. When the count down ends, it triggers act_hide_starting action.
  • hide startingCnd which was finished
  • show RecordingSec countdown layer
  • Play RecordingSec countdown
  • External code "myrecord.lua" to start recording
  • Message1 "now recording .." is displayed
  • act_hide_all


    set this action first action in another action and you can set 'Show' with the target layers to be displayed.

    act_hide_recording


    When RecodingSec countdown ends, it triggers this action to stop Recording
  • hide all layers
  • hide RecodingSec countdown
  • show Play button
  • show Delete button
  • hide "now recording .." message
  • External code "mystop.lua"
  • act_init


    this action is called with the timer when the page is loaded. ( The timer is set with 0 sec ).
  • External code "myinit.lua" that set isRecordedData true or false
  • hide all layers
  • if isRecordedData == true
  • show Play
  • show Delete
  • else
  • show Record
  • show message "3 sec.."
  • endif
  • but_record


    starts 3 sec countdown before recording.
  • Play startingCnt countdown
  • show startingCnt layer
  • show Stop button
  • hide Record button
  • hide "Wait 3 sec .." message
  • but_stop


    stops recording
  • External code "mystop" to stop recording
  • hide all layers
  • if isRecordedData
  • show Play button
  • show Delete button
  • else
  • Recode button
  • end
  • hide "Wait 3 sec .." message
  • but_play


    plays the recorded voice by extenal code "myplay.lua"

    but_delete


    shows up Yes/No buttons

    but_yes


    deletes the recorded voice
  • hide all layers
  • External Code "mydelete.lua"
  • Show Record button
  • but_no


    cacnel "delete"

    hides YES/No buttons and back to show Play/Delete buttons

    Add Variable


    isRecordedData to be used in the external code files

    startingCnt countdown

  • Countdown for 3 sec to read story for recording
  • it triggers act_hide_starting
  • RecordingSec countdown

  • Coutdown while recording.
  • It triggers act_hide_recording
  • Please set recording time in seconds. The sample is 5 seconds. You also set the time in external code too. See the extenal code below.
  • Timer Init


    this timer is called once when page starts with 0 second

    myinit.lua


    it checks whether isRecodedData exist or not

    myrecord.lua


    Please set your recording time in the first line

    myplay.lua

    mystop.lua

    mydelete.lua



    if you want to use the recording function created above to other pages, please refer 27 external codes multi page tutorial.
    http://kwiksher.com/tutorials_kwik/external-codes-multi-pages/