0 Replies Latest reply on Mar 7, 2014 2:00 AM by MinalL

    Play AVI File from local filesystem location on button click event

    MinalL

      Hi All,

       

       

      We need to create a acroform PDF template which will contain a button. On click event of that button field we want to play AVI file which is present in local filesystem.

       

      Can someone suggest what approach should be followed to make this work?

       

      If same AVI file is attached to PDF and opened via dataobjects then it was played. But this approach has limitations of increase in PDF size and causing slow operations.

       

      I have tried following code

       

      var args =  {

             doc: this.document,

             rendition:  {

                      altText: "My Sample Earth Video alteranate text",

               doc: this.document,

               fileName: urlToBeOpened,

               type: app.media.renditionType.media,

               uiName: "My Sample Earth Video"          

                },

             URL: urlToBeOpened,

             mimeType: "video/avi",

             fromUser: true,

             showAltText: true,

             settings:  {

                 autoPlay: false,

                 data: app.media.getURLData(urlToBeOpened,"video/avi"),

                 windowType: app.media.windowType.floating,

                 floating:  {

                     align: app.media.align.topCenter,

                     over: app.media.over.appWindow,

                     canResize: app.media.canResize.no,

                     hasClose: true,

                     hasTitle: true,

                     title: "My Sample Earth Video Title",

                     ifOffScreen: app.media.ifOffScreen.forceOnScreen,

                     width: 400,

                     height: 300

                    },

                 layout: app.media.layout.meet,

                 monitor: app.monitors.primary(),

                 page: 0,

                 showUI: true,

                 visible: true

                }

            };

         var player = app.media.createPlayer(args);

         console.println("Called createPlayer");

         if(player)

         {

          console.println("Returned Player object.");

          player.close(app.media.closeReason.general);

          var result = player.open(true, false);

          printPlayerProperties(player);

          console.println("called open");

          if(result.code != app.media.openCode.success)

          {

           console.println("Error in opening player object");

           player = null;

           app.media.alert

           ("Open", args, { code: result.code });

          }

          else if(player.visible)

          {

           console.println("Opened Player successfully");

           player.setFocus(); // triggers Focus event

          }

         }

       

      But this code gives error

       

      app.media.priv.createPlayer
      Called createPlayer
      Returned Player object.
      Exception in line 36773 of function anonymous, script
      Exception in line 36781 of function anonymous, script
      Exception in line 1319 of function anonymous, script Document-Level:Script1
      Exception in line 1 of function top_level, script AcroForm:OpenAVIFile:Annot1:MouseUp:Action1

      InvalidArgsError: Invalid arguments.
      MediaPlayer.privOpen:-1:AcroForm:OpenAVIFile:Annot1:MouseUp:Action1

       

      Any help in this regards will be greatly appreciated.

       

      thanks,

      Minal