Skip to content

Repository files navigation

TiScreenRecorder

A simple Appcelerator Titanium module for iOS screen recording.


Usage

Example app.js

// TiScreenRecorder : example app. // @kosso : November 2016// open a single windowvarwin=Ti.UI.createWindow({backgroundColor:'white'});varlabel=Ti.UI.createLabel({text: 'ready',backgroundColor: '#99ffffff',color: '#333',width: Ti.UI.SIZE,borderRadius: 6,bottom: 5,left: 5,zIndex: 10});win.add(label);varscreenrecorder=require('com.kosso.tiscreenrecorder');varisRecording=false;varbtn_rec=Ti.UI.createButton({title: ' o ',width: 30,bottom: 5,zIndex: 10,height: 30,borderRadius: 15,color: 'white',tintColor: 'white',textAlign: 'center',backgroundColor: '#990000'});btn_rec.addEventListener('click',function(){if(isRecording){screenrecorder.stopRecording();label.text='stopped';setTimeout(function(){label.text='ready';},3000);}else{vard=newDate();varfilename='recording_'+d.getTime()+'.mp4';varfile=Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);if(file.exists()){file.deleteFile();}varvideo_url=file.nativePath;// eg: file:///etc/etc...file=null;console.log('video_url : ',video_url);screenrecorder.startRecording(video_url);// To just automatically save the video to the Camera Roll, leave out the video url // eg: screenrecorder.startRecording();label.text='recording';}isRecording=!isRecording;});screenrecorder.addEventListener('success',function(e){console.log('screen recording done! : ',e);// Saved video is at e.nativePath (if a video_url was set)});// Just something to record... varwv=Ti.UI.createWebView({url : 'http://www.bbc.co.uk/news',width: Ti.UI.FILL,height: Ti.UI.FILL,backgroundColor: '#eee',zIndex: 1});win.add(wv);win.add(btn_rec);win.open();

Ideas:

  • Hide recording button when starting. Add a shake gesture to stop recording.

  • Add audio recording.

  • Allow specifying an area of screen to record.

  • Generate a GIF ;)

  • Show location of touches.


Credit :


Author : @kosso - November 2016

About

A simple Titanium iOS module for screen recording.

Topics

Resources

Stars

28 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages