Virtual Film Maker Open Intents

Home ] 10000 Steps ] Brain Dropper ] Ideal Slideshow ] Media Pulse ] Angles ] Ideal Player ] Triplex Weather Widget ] Sagitta news reader ] Virtual Film Viewer for Android ] VFV Description ] VFM for Android 3.0 ] VFM for Android 3.0 Description ] VFM for Android 2.2 ] VFM for Android 2.2 Description ] 'Virtual Film Maker' Raves ] Android Open Intents ] Transcribers ] E-Mail ]

Virtual Film Maker Open Intents

Intents

Starting from v. 20 Virtual Film Maker provides intents OPEN_FILM, PLAY_FILM and extras for Android developers to present an "Open film" and "Play Film"commands.

Intent Action
com.fastclipper.vfm.action.OPEN_FILM Launches VFM and opens a virtual film.
com.fastclipper.vfm.action.PLAY_FILM Launches VFM, opens a virtual film and starts playback.

Extras for OPEN_FILM intent

The OPEN_FILM intent has no extras.

Example

To launch the OPEN_FILM command, the application should use the code like this:

 

Intent intent = new Intent("com.fastclipper.vfm.action.OPEN_FILM");
intent.setData(Uri.parse("file://" + SELECTED_FILM_PATH));
startActivity(intent);
 

The code launches Virtual Film Maker and forces the selected virtual film to open.

Hint

If startActivityForResult is called instead of startActivity (not recommended), then Virtual Film Maker will exit when user switches view (f.e. from Gallery to List). See onActivityResult below.

 

Extras for PLAY_FILM intent

Here is a list of extras for PLAY_FILM intent. Clip indexes always start from 1.

Extras Description
com.fastclipper.vfm.intent.extra.start_clip_index Start clip index. Integer. Optional.
com.fastclipper.vfm.intent.extra.final_clip_index Final clip index. Integer. Optional.
com.fastclipper.vfm.intent.extra.exit_on_film_over Exits VFM when film (or final clip) is over. Boolean. Optional.

Example

To launch the PLAY_FILM command, the application should use the code like this:

 

void RunVFM(String fpath, int iClipStart, int iClipFinal, boolean bExitOnOver) {

Intent intent = new Intent("com.fastclipper.vfm.action.PLAY_FILM");
intent.setData(Uri.parse("file://" + fpath));

intent.putExtra("com.fastclipper.vfm.intent.extra.start_clip_index", iClipStart);
intent.putExtra("com.fastclipper.vfm.intent.extra.final_clip_index", iClipFinal);
intent.putExtra("com.fastclipper.vfm.intent.extra.exit_on_film_over", bExitOnOver);

startActivityForResult(intent, REQUEST_CODE_VFM_PLAY_FILM);
}

The code launches Virtual Film Maker, opens the selected virtual film (in List View, the 'Restore Last View on Startup' setting is ignored) and forces playback from the start clip index.

When the film is over or final clip is over (provided bExitOnOver is set to 'true') or user exits Virtual Film Maker(presses the Back button), the control returns to the calling application.

 

String extra_vfm_result = "com.fastclipper.vfm.intent.extra.vfm_result";

protected void onActivityResult(int requestCode, int resultCode, Intent i){
   super.onActivityResult(requestCode, resultCode, data);
   if(requestCode==REQUEST_CODE_VFM_PLAY_FILM) {
      if(resultCode==(RESULT_FIRST_USER + 1)) {
         // OK. Film is Over.
      }
      else if(resultCode==(RESULT_FIRST_USER + 2)) {
         // VFM was cancelled ('Back' button was pressed).
      }
      else if(resultCode==(RESULT_FIRST_USER + 3)) {
         // STARTUP ERROR. Invalid intent parameters.
         String url = i.getExtras().getDataString();
         String errDesc = i.getExtras().getString(extra_vfm_result);
         // report error here...
      }
      else if(resultCode==RESULT_OK || resultCode==RESULT_CANCELED) {
         // view was switched and user pressed 'Back' button
      }
   }
}

 


vfm:// protocol

Virtual Film Maker is declared as handler of the "vfm://" protocol in the Android manifest. This allows launching Virtual Film Maker from hyperlinks.

HTML file looks ordinarily, but links use the "vfm://" protocol. When user clicks the hyperlink in the browser, then Android launches Virtual Film Maker (or another "vfm://" protocol handler application).

Test HTML file in HTML viewer.

 

Here is the corresponding HTML code. The parameters should be replaced with real values.

<html>
<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<meta http-equiv=description content='© 2011 - 2012, Virtual Films Software' />
<title>Testing Virtual Film Maker vfm:// protocol</title>
</head>
<body><div align='left'>
<table border='0' width='563' id='table3' cellpadding='0'><tr><td>
<h2 align="center">Virtual Film Maker</h2>
<h2 align="center"><font color="#008080">Testing vfm:// protocol</font></h2>
</td></tr><tr><td>
<table border='1' width='100%' id='table4' style='border-collapse: collapse'><tr><td><hr>
<h3 align="center"><a href="vfm://www.fastclipper.com/
?action=open_film&film_path='__FILM_PATH__'">Open Film</a></h3>
<h3 align="center"><a href="vfm://www.fastclipper.com/
?action=play_film&film_path='__FILM_PATH__'
&start_clip_index=__CLIP_START_
&final_clip_index=__CLIP_FINAL_
&exit_on_film_over=__EXIT_OVER__">Play Film</a></h3>
<p align="center">&nbsp;</td></tr></table></td></tr></table></div></body></html>

 


Demo Application

The 'VFM Open Intents Demo App' free application shows how the code works.

 
Program Download Link
Download VFM Open Intents Demo App. This program is FREE. v. 1.0.1, 25 Kb, VFMTestIntents.APK

 

The main window allows user to enter intent action and arguments as well as switch to Web view for testing "vfm://" protocol handler.

Keep in mind, that for the 'Browse' button to work, the external file manager should be installed.
Both 'OI File Manager' and 'ES File Explorer' are supported.

Here are some screenshots.

Screenshot Description

Testing OPEN_FILM intent.

Testing PLAY_FILM intent.

"Test vfm:// protocol" opens Web View.

Web View shows test HTML code.

Note the full text of the <href> HTML tags in the upper part of the window.

Home ] 10000 Steps ] Brain Dropper ] Ideal Slideshow ] Media Pulse ] Angles ] Ideal Player ] Triplex Weather Widget ] Sagitta news reader ] Virtual Film Viewer for Android ] VFV Description ] VFM for Android 3.0 ] VFM for Android 3.0 Description ] VFM for Android 2.2 ] VFM for Android 2.2 Description ] 'Virtual Film Maker' Raves ] Android Open Intents ] Transcribers ] E-Mail ]

© 2009-2012. Virtual Films Software.

Android is a trademark of Google Inc.

www.FastClipper.com