New 2015 Update

Unless you have been asleep for the past few days, you most likely are aware that the big update release for Adobe Creative Cloud applications (CC 2015) is now available. So what is in store for InDesign users? The new feature list is not long, but quite exciting. First, InDesign now gives you access to the libraries you have in Creative Cloud. Yes, these are the same on-line libraries that you have been using in Photoshop and Illustrator CC 2014.

Users will also notice some improvements in working with tables, most notably the fact that a table cell can now act as a container for images.

But best of all, especially for those of us who are interested in publishing to EPUB and web, is the new Publish Online feature. Imagine, being able to publish any InDesign document online and share it on Facebook or as a standalone URL. Yes, it’s what Adobe calls a technical preview, but what I have seen of it so far, is very promising. You can read more about it at helpx.adobe.com.

Our next series of blogs will focus on this feature from an automating InDesign perspective, so watch for these discussions. For now, our focus will be on automating placement of videos and sounds in a Fixed Layout EPUB.

MEDIA IN FIXED LAYOUT EPUB

Adding video and sound to your fixed layout EPUB is as easy as adding pictures or text files. For example, you may want to add a short video to your fixed layout EPUB. You could also add a short bit of music that plays when your EPUB is first opened or a page is turned. But there are some rules you need to be aware of:

    Make sure your video and audio files are in a the correct format:
  • Use MP3 format for audio
  • Use MP4 for video (or anything that is H264 encoded)

Remember, you can convert an original .mov file to MP4 using Adobe Media Encoder.

Manual Placement

To place a video file, go to File > Place. Choose the video. Then using Cmd+Shift (Ctrl + Shift for PC), scale the video proportionally.

You can also click the Place a Video or Audio File button at the bottom of the Media panel to place a video or sound file.

Once you have the media file placed, open the Media Panel from InDesign’s Window Menu (Window > Interactive > Media). This is the panel you will use for working with placed audio and video. From this panel you can preview your video using the Play button. Here you can also determine whether the video will play on page load or loop. For fixed layout EPUB neither play option should be used. This allows InDesign to export the correct markup for the default controller of the eReader device. Accordingly, leave the controller set at None.

Poster Frames

A Poster Frame is the frame of the video that displays when the video is not playing. The default is to use the first frame of the video. You can choose to use one of the frames in the video or just choose a standard and basic poster image.

A placed sound file can also display a poster frame. The standard sound icon is actually the image StandardSoundPoster stored i the Presets > Multimedia folder in the InDesign application folder. You can open this file and make changes to it. This will then become your standard sound file poster.

Automated Placement

You can write a script with ExtendScript or AppleScript to place, size, and set up the automation for playing audio and/or video. The procedure is the same for both scripting languages, only the syntax changes. The following is an example of a script written for AppleScript that has the user choose from a list of .mp4 files found in the user’s movies folder. It then places the file and sizes it proportionally to fit the bounds defined by the variable movieBounds. The script assumes the following:

 

  • There is an InDesign CC 2015 document open having three facing-page spreads (4 pages).
  • The InDesign document was created with web intent having measurement units in pixels
  • The video file is in the correct format and located in the user’s Movies folder
  • The video will scale to 400 by 600 proportionally

Place Video

   set movieBounds to {36, 36, 400, 600}
   set movieSpread to 2
   set moviePage to 1
   set movieControls to true
   try
      tell application "System Events"
	 set moviePath to path to movies folder from user domain
	 set movieString to moviePath as string
	 set movieList to name of every disk item of moviePath where name extension is "mp4"
      end tell
      if length of movieList > 0 then
	 set movieFileRef to getMediaFile(movieList, movieString)
	 placeMovie(movieFileRef, movieBounds, movieSpread, moviePage, movieControls)
       end if
   on error errMsg
       activate
       display alert errMsg
   end try
   (*Presents user with list of files from which to choose and returns alias to file chosen*)
   on getMediaFile(nameList, pathString)
	set fileName to choose from list nameList with prompt "Select media file for placing"
	if fileName is not false then
	   set fileToPlace to (pathString & fileName) as alias
	   return fileToPlace
	else
	   error "User Cancelled choose file from list"
	end if
   end getMediaFile
   (*Places movie to page of spread referenced and resizes to bounds defined by movieBounds.
   showControls is boolean indicating if controls for movie should be shown*)
   on placeMovie(movieFileRef, movieBounds, spreadNumber, pageNumber, showControls)
	tell application "Adobe InDesign CC 2015"
	   set spreadRef to spread spreadNumber of document 1
	   tell spreadRef
		set pageRef to page pageNumber
		set placedItem to place movieFileRef on pageRef
	   end tell
	   set movieRef to item 1 of placedItem
	   set rectRef to parent of movieRef
	   set geometric bounds of rectRef to movieBounds
	   tell rectRef to fit given proportionally
		set show controls of movieRef to showControls
	   end tell
   end placeMovie

Notice that the placeMovie handler in the script above sets the show controls property for the movie to true. When the Fixed Layout EPUB is viewed on either Adobe Digital Editions or iBooks, the controls appear below the video. With movie poster type set to from movie, the poster defaults to the first frame.

Remember that it is best to leave the movie loop and play on page turn properties to the default value of false so InDesign can set the markup for the movie to play correctly on the eReader device.

Place Sound

Working with a sound file is similar to the process outlined above for working with a movie file.

A script for placing the file will be similar to the Place Video script above with the following exceptions:

    • Predefined values for variables will be required at the top of the script
   set soundBounds to {400, 520, 460, 580}
   set soundSpread to 3
   set soundPage to 1
   set hidePoster to false
   set autoPlay to true
    • The list of sound files will be that of MP3 files found in the user’s music folder.
      tell application "System Events"
	 set soundPath to path to music folder from user domain
	 set soundString to soundPath as string
	 set soundList to name of every disk item of soundPath where name extension is "mp3" or name extension is "mp4"
      end tell
      if length of soundList > 0 then
	 set soundFileRef to getMediaFile(soundList, soundString)
	 placeSound(soundFileRef, soundBounds, soundSpread, soundPage, hidePoster, autoPlay)
      end if
    • The script requires a handler placeSound to place the sound
on placeSound(soundFileRef, soundBounds, spreadNumber, pageNumber, hidePoster, autoPlay)
    tell application "Adobe InDesign CC 2015"
       set spreadRef to spread spreadNumber of document 1
       tell spreadRef
          set pageRef to page pageNumber
          set rectRef to make rectangle with properties {geometric bounds:soundBounds, fill color:"None", stroke color:"None", stroke weight:0}
          tell rectRef
             set placedItem to place soundFileRef
             end tell
          end tell
          set soundRef to item 1 of placedItem
          set rectRef to parent of soundRef
          set geometric bounds of rectRef to soundBounds
          tell soundRef
             set sound poster type to standard
             set do not print poster to hidePoster --do not print poster with document
             if autoPlay is true then
                set play on page turn to true
                set stop on page turn to true
             end if
           end tell
       end tell
    end placeSound

When a sound is included on a page, it acts like a button that can play the sound when clicked. Therefore you might want to include a poster, or visual indicator, that lets people know that there is a sound on the page. In the InDesign document, the sound clip contains a special icon within its frame that identifies it as a sound item. The poster to use for the sound file is identified by its sound poster type property. For the most part, you can use standard. But you can define a file of your own (60 pixels square). The sound’s do not print poster property determines if the poster should show in the output. None leaves the sound clip frame empty. Standard uses the standard sound poster image.

For an interactive PDF file, the sound poster shows as the right icon in the screen capture below. For Fixed Layout EPUB there is no poster, but a small sound control appears instead. (Icon on the left in screen capture below.)

Sound file display for PDF (right), EPUB (left)

ON YOUR OWN

Don’t forget to include the getMediaFile handler in your script. See if you can create this script on your own. Then, go on to combine both the Place Video and Place Sound scripts into one.

Just for testing, we published a sample EPUB Online. Click Here You may recognize the animations from some of our previous blogs.