Apache POI XSLF Adding movie to the slide

北战南征 提交于 2019-12-02 10:09:06

Beginning from Powerpoint 2010 it's possible to embed videos in PPTX-files (... instead of linking them or using some kind of ActiveX/youtube combo). If you embed MP4-videos you need to have the Quicktime plugin installed.

Regarding the playback controls, my PP 2010 viewer displays them when you move the mouse over the video shape. Sometimes they never show up again, when you click straight into the image instead of waiting for the popup.

The following code ...

  • fetches a MPEG (could be also a local file)
  • creates a snapshot of the frame on the 5th second, which is used as the preview image. I've used the Xuggle libs here, but of course any other libs are ok too (... plain JMF (without extension pack) couldn't handle (this) MPEGs)
  • embeds image and video
  • and adds some arbitrary ;) stuff, which PP needs to actually play the video

Here is the code: https://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/AddVideoToPptx.java.txt

(Update 2016-02-06: moved the code to POI examples, so there's only one place to be modifed in case of new features. Furthermore there was a regression in POI 3.13 making it impossible to add pictures after adding movies to the media directory - this is fixed in the upcoming POI 3.14)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!