O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing video files from the filesystem

Now that we have recorded a video, how about playing it back? Titanium has an inbuilt video player component that can play both local files and remote video URLs. In this recipe, we'll show you how to create the video player control and pass it the local file URL of the video that we recorded in the previous recipe.

How to do it...

In our app.js file, underneath the declaration of the videoFile object, we create the following function:

function playMovie(){ //create the video player and add it to our window //note the url property can be a remote url or a local file var my_movie = Ti.Media.createVideoPlayer({ url: videoFile, width: 280, height: 200, top:20, left:20, backgroundColor:'#000' }); win2.add(my_movie); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required