VIDEO IN FLASH FOR THE POCKET PC


Often, you'll need to use a video or video-like effects in your project. Or, you'll want to create a standalone video player with your own user interface. Also, many clients will want Flash MX-like effects; this section addresses some of the many video-in-Flash techniques.

Windows Media Playeron the Pocket PC

Included on almost all Pocket PC 2002 devices is the Windows Media Player 8 for Pocket PC (see Figure 2.19).

Figure 2.19. The Windows Media Player for Pocket PC playing a video.

graphics/02fig19.gif

Windows Media Player supports the organization and playback of Windows Media content through play lists, MP3 audio files, Windows Media Audio, Windows Media Video, FhG MP3, and streamed content in Windows Media format using WM protocols (HTTP and MMS). Most desktop users (over 70%) currently use the Windows Media Player and they're already familiar with the interface, so in most cases using the Windows Media Player for video is often the best choice.

If the user has Windows Media Player 7 or above on his PC, he can use it to easily transfer digital media files to his Pocket PC (see Figure 2.20).

Figure 2.20. The desktop Windows Media Player.

graphics/02fig20.gif

Also, with a wave of digital rights based content, users will soon be playing more content that has been purchased, such as music. Flash works well with other applications, just like the desktop, so it's important to start planning for what is to come with engaging combinations of Flash and Windows media content for the Pocket PC.

graphics/01icon12.gif

To download the latest version of the Windows Media for Pocket PC, visit: www.microsoft.com/windows/windowsmedia/download/pocket.asp.


Launching a Windows Media file from Flash on the Pocket PC is as simple as linking to a file via getURL . For example:

 on (press) {     getURL ("video.wmv");  } 

After the user is finished with the video and closes out of the application, it will return the user to the page he just came from. Actually, let's be a little more specific and mention a few caveats. "Closing" an application on the Pocket PC is actually just placing it in the background. So if you have any sounds or animations in your Flash application on the Pocket PC, be sure to stop the animations and sounds when launching a user to another application. This can be accomplished by using the stop (); command on the timeline and stopAllSounds (); in the movie. In fact, this is why it's usually a good idea not to have a background track running or intense animations at all times, or to create a timeout.

You can also quit almost any application on the Pocket PC by using the built-in keyboard. To quit an application with the built-in keyboard, tap Ctrl and then the Q key (just like the desktop) and that closes most applications, including Internet Explorer for the Pocket PC.

If you plan to open extremely large documents from Pocket Internet Explorer, you may want to consider deploying an additional ActiveX control with your application if it's permitted. The AppLaunch ActiveX Control from Microsoft makes it possible to open large files more quickly in Internet Explorer for the Pocket PC. It bypasses the temporary cache, resulting in a faster launch of the application launching as if it is in File Explorer. To download the ActiveX control, visit: www.microsoft.com/mobile/developer/downloads/powertoys.asp.

To use this ActiveX control within Flash, call the JavaScript function from within Flash (be sure to consult the ActiveX control documentation as well). To call the AppLaunch Active Control, add the following action to a button inside Flash:

 on (press) {     getURL ("javascript:LaunchMe();");  } 

In this HTML file you have the script that's ready to be called:

 <HTML>  <HEAD>  <TITLE>exe_tester</TITLE>  </HEAD>  <BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">     <SCRIPT LANGUAGE="JScript">  function LaunchMe()  {    var Launch;    var ExeName = "\\windows\\player.exe";    var ExeParam = "\\My Documents\\video.wmv";    Launch = new ActiveXObject("AppLaunch.Launch");    Launch.ExeName = ExeName;    Launch.ExeParam = ExeParam;    Launch.Run();     // Launches "player.exe" with "video.wmv" as a parameter  }     </script>  <CENTER>  <OBJECT class  codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"  ID=PocketPC  WIDTH=240 HEIGHT=240>  <PARAM NAME=movie VALUE="exe_tester.swf"> <PARAM NAME=quality VALUE=high> <PARAM  graphics/ccc.gifNAME=bgcolor VALUE=#FFFFFF>  </OBJECT>  </CENTER>  </BODY>  </HTML> 

We've included this example on the Flashenabled.com/book site if you need to take a closer look at it.

graphics/01icon12.gif

See Appendix C for links to resources on creating video for Pocket PC.


Video Inside Flash on the Pocket PC

In some cases you may decide that the Windows Media Player for Pocket PC doesn't have the level of control that your application requires. For those instances, as well as design projects which may require "video-like" effects, here are two ways to get Flash content to play video on the Pocket PC.

Importing a Sequence of Bitmap Images

The first technique is basically importing a sequence of bitmap images in a series of keyframes to simulate video. Usually, you import the video into Flash first, export it as a bitmap sequence, then import it back in (with sound track imported as well). Flash will do a pretty good job of making short video clips (usually a few seconds) fairly video-like.

Let's create a short video clip. Set up your movie, 240x240, 12 frames per second, with a white background.

  1. Be sure you have QuickTime installed (www.apple.com); also use QuickTime Pro (that means you need to pay the $20) it's worth it. Import a QuickTime movie (File, Import) onto the main stage. Resize the file to fit inside the stage. You can get the sample movie we're using from the Flashenabled.com/book site or use your own. Flash will ask if you'd like to embed video in a Flash document, or link to the video; choose Link to External Video file. Resize the video to 240x180.

    graphics/01icon12.gif

    Although you can directly embed video inside Flash (Flash 6 Player) using Flash MX, that feature is not supported on the Flash Player 5 for Pocket PC at this time. Use the other methods described here to embed video on the Pocket PC with Flash.


  2. Keep inserting frames on the timeline (Insert, Frame) until the QuickTime is fully visible (see Figure 2.21). If you see an X in the QuickTime box, you have gone too far.

    Figure 2.21. QuickTime inserted on the main timeline.

    graphics/02fig21.gif

  3. Now export the movie by selecting File, Export Movie to display the Export Movie dialog box (see Figure 2.22).

    Figure 2.22. Exporting the movie as bitmaps.

    graphics/02fig22.gif

  4. In the Save As Type field, choose Bitmap Sequence (*.bmp).

  5. Choose the folder you want, enter a filename, and click Save.

  6. Use the settings in Figure 2.23 for the images. On a Mac, use similar settings for PICTs.

    Figure 2.23. Export settings.

    graphics/02fig23.gif

  7. Now in the QuickTime Player application (you should be using QuickTime Pro or another video editing application), export the sound track in Flash as a WAV file or other importable sound file for your particular system.

  8. Go back to the Flash movie and delete the QuickTime movie on the stage by selecting it and pressing Delete.

  9. Next, import the images (File, Import) and select the first image. When Flash figures out that this is part of a series of images and asks to import them all, select Yes. You may need to move the images for proper placement.

  10. Now add a new layer to the Flash movie (Insert, Layer). Import the sound into Flash using File, Import (see Figure 2.24).

    Figure 2.24. The sound imported to the main timeline.

    graphics/02fig24.gif

  11. Open the Library (Window, Library) and drag the sound onto the layer called soundtrack. Click the timeline and under the sound panel (Window, Properties) choose Stream under the Sync pull-down list. This makes the soundtrack match up with the movie.

Test your movie (Control, Test Movie). In Publish Settings (File, Publish Settings) under the Flash tab you can adjust the JPEG settings to make the movie smaller or larger in file size and memory. The technique of using imported bitmaps is good in some cases, but be aware that this is extremely memory intensive and can cause the Flash Player for Pocket PC to crash.

graphics/01icon13.gif

Before you transfer the HTML and Flash file (SWF) to the Pocket PC, be sure to review the " Copying Content to the Pocket PC: A Checklist " section of this chapter.


Video with Wildform Flix

The other method of using video inside Flash for the Pocket PC is to use a third-party tool such as Wildform Flix (www.wildform.com).

With Wildform, you can avoid 99% of the work of the previously described technique, and get results that are much better (and smaller). Flix is the best video-to-SWF (Flash movie) encoder. It is the most stable, has the best quality, converts the most file types, is available for both PC and Mac, offers great support and resources, and it comes with discounts on royalty free video from the Wildform Video Library (which is useful if you need quick content for your projects). Using Flix, you can also save encoding profiles specifically for the Pocket PC (much like the Windows Media Encoder). Flix converts the following video formats into Flash movies: .mov, .qt, .dv, .avi, .mpeg (PC Only), .wmv, .asf. The Flix screen is shown in Figure 2.25.

Figure 2.25. Wildform Flix is the best video-to-SWF encoder.

graphics/02fig25.gif

Using Flix, encoding video for use in Flash only involves three steps:

  1. Choose the input file.

  2. Select your preset.

  3. Click "encode."

At the main Wildform web site, there is a fully functioning demo of Flix. There are tons of sample movies and custom players to try out. After creating Flash movies with Flix, you can load them into your Flash movie using loadMovie :

 loadMovieNum ("myvideo.swf", 0);  loadMovie ("myvideo.swf", "holder"); 

On the Flashenabled.com site we've included a few samples and source files for integrating video SWFs from Flix into Flash for Pocket PC applications.

As with the first video-in Flash-technique, using large SWFs with bitmaps and sounds can cause the Flash Player for Pocket PC to bring the processor to its knees. Proper testing and planning will prevent your applications from crashing or causing sluggish performance. In the next section, we'll explore ways to manage memory in and out of Flash for the Pocket PC.



Macromedia Flash Enabled. Flash Design and Development for Devices
Macromedia Flash Enabled. Flash Design and Development for Devices
ISBN: 735711771
EAN: N/A
Year: 2002
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net