1 Reply Latest reply on Apr 13, 2015 10:22 AM by jfavelle

    Embed a video from the web in a page

    jfavelle

      Hey All,

       

      I'm trying to figure out how to embed a video from the web via scripting.  I know you can set a web overlay and then put the link in there but can't seem to find a way to do this via scripting?

       

      Any help would be great.

       

      Thanks

        • 1. Re: Embed a video from the web in a page
          jfavelle Level 1

          I realize I should have included some details in this thread originally. I’m working with InDesign CS6 and writing a javascript that creates a web overlay and then assigns a video to it on the InDesign page. The code that I’ve written so far presents a dialog to the user where they can fill in the size of the web overlay and an ID of the desired video. This code works as follows…

           

          #target "InDesign"

           

          var myDialog = app.dialogs.add({name:"Add Kaltura Video",

          canCancel:true});

          with(myDialog){

           

          with(dialogColumns.add()){

             staticTexts.add({staticLabel:"https://kmc.kaltura.com/index.php/kmc"});  

           

          with(borderPanels.add()){

          with(dialogColumns.add()){

           

          staticTexts.add({staticLabel:"Kaltura Video ID:"});

          }

          with(dialogColumns.add()){

           

          var kalturaIdBox = textEditboxes.add

          ({editContents:"", minWidth:180});

          }

          }

           

          with(borderPanels.add()){

          with(dialogColumns.add()){

          staticTexts.add({staticLabel:"Size:"});

          }

          with(dialogColumns.add()){

           

          var kalturaSizeMenu = dropdowns.add

          ({stringList:["1/2", "1/3", "2/3"], selectedIndex:0});

          }

          }

           

          with(borderPanels.add()){

          with(dialogColumns.add()){

          staticTexts.add({staticLabel:"Aspect Ratio:"});

          }

          with(dialogColumns.add()){

           

           

          var kalturaRatioMenu = dropdowns.add

          ({stringList:["4:3", "16:9"], selectedIndex:0});

          }

          }

           

          with(borderPanels.add()){

          staticTexts.add({staticLabel:"Render Option:"});

          var renderOptionMenu = dropdowns.add

          ({stringList:["Play Button Only", "Inline Player"], selectedIndex:0});

          }

          }

          }

           

          if(myDialog.show() == true){

          var kalturaId, myKalturaSize, myKalturaRatio, myRenderOption

           

           

          kalturaId = kalturaIdBox.editContents

           

           

          if(kalturaSizeMenu.selectedIndex == 0){

          myKalturaSize = '1/2';

          }

          else if(kalturaSizeMenu.selectedIndex == 1){

          myKalturaSize = '1/3';

          }

          else{

          myKalturaSize = '2/3';

          }

           

           

          if(kalturaRatioMenu.selectedIndex == 0){

          myKalturaRatio = '4:3';

          }

          else {

          myKalturaRatio = '16:9';

          }

           

           

          if(renderOptionMenu.selectedIndex == 0){

          myRenderOption ='PlayButtonOnly';

          }

          else{

          myRenderOption = 'InlinePlayer';

          }

          myDialog.destroy();

          }

           

          var myDocument = app.activeDocument;

          with(myDocument){

          var myPage = pages[0];

           

          }

          with(myPage){

          //Create a text frame

          if (myKalturaSize = '1/2') {

            xFrame = 452 + "px";

          }

          else if (myKalturaSize = '1/3')  {

              xFrame  = 290 + "px";

              }

          else {

              xFrame = 613 + "px";

              }

           

          var mybounds = new Array();

          mybounds[0] = 0;

          mybounds[1] = 0;

          mybounds[2] = 304;

          mybounds[3] = xFrame

           

          //Rectangle fit to Page

          myDocument.pages[0].rectangles.add({geometricBounds: mybounds, strokeWeight: 5, strokeColor: "Black", fillColor: "None"});

          myObj = myDocument.pages[0].rectangles[0];

          myObj.insertLabel("kAdobeDPSInteractivity_Type","WebView");

          myObj.insertLabel("kAdobeDPSInteractivity_WebViewOverlayContainer","true");

           

          All of this works, but what I’m wrestling with now is a way to assign or place a specific video to the web overlay. Any help is greatly appreciated.