Thanks for your inquriy. In reference to above resolved issue(PDFNET-39606), We have implemented a new annotation RichMediaAnnotation in Aspose.Pdf for .NET 17.3.0. Please note MovieAnnotation can just play link to the external video file (placed on disk or internet). However RichMediaAnnotation is used to play media stored within PDF document.
In fact RichMediaAnnotation is container for SWF (Flash) script. Due to license restriction we can not include third-party flash scripts in our product, so you should provide your script for playing video or audio. For example you can use VideoPlayer and AudioPlayer shipped with Adobe Acrobat. It is placed in Acrobat folder Acrobat\Multimedia Skins\Players.
Please check following sample code for embedding video/audio files in PDF document using RichMediaAnnotation.
Aspose.Pdf.Document
doc = new Aspose.Pdf.Document();<o:p></o:p>
Page page = doc.Pages.Add();
RichMediaAnnotation rma = new
RichMediaAnnotation(page, new Aspose.Pdf.Rectangle(100,
500, 300, 600));
//here we should specify stream
containing code of the video player
rma.CustomPlayer =
new FileStream(@"Acrobat\Multimedia
Skins\Players\Videoplayer.swf",FileMode.Open,
FileAccess.Read);
//give name to video data. This data
will be embedded into document with this name and referenced from flash
variables by this name.
// videoName
should not contain path to the file; this is rather "key" to access
data inside of the PDF document
string videoName = "VideoTutorial.mp4";
//also we use skin for video player
string skinName = "SkinOverAllNoFullNoCaption.swf";
//compose flash variables line for
player. please note that differnet players may have different format of the
flash variabless line. Refer to documentation for your player.
rma.CustomFlashVariables = String.Format("source={0}&skin={1}", "VideoTutorial.mp4", skinName);
//add skin code.
rma.AddCustomData(skinName,
new FileStream(@"Acrobat\Multimedia Skins\SkinOverAllNoFullNoCaption.swf",
FileMode.Open, FileAccess.Read));
//set poster for video
rma.SetPoster(new FileStream(myDir + "Aspose.jpg",
FileMode.Open, FileAccess.Read));
Stream fs = new FileStream(myDir + videoName, FileMode.Open, FileAccess.Read);
//set video content
rma.SetContent(videoName, fs);
//set type of the content (video)
rma.Type = RichMediaAnnotation.ContentType.Video;
//active player by click
rma.ActivateOn = RichMediaAnnotation.ActivationEvent.Click;
//update annotation data. This method
should be called after all assignments/setup. This method initializes data
structure of the annotation and embeds required data.
rma.Update();
//add annotation on the page.
page.Annotations.Add(rma);
doc.Save(myDir + “39606-1.pdf”);