ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* JavaScript in multimedia PDF
@ 2021-08-08 18:22 Pablo Rodriguez via ntg-context
  2021-08-08 21:00 ` Michal Vlasák via ntg-context
  0 siblings, 1 reply; 9+ messages in thread
From: Pablo Rodriguez via ntg-context @ 2021-08-08 18:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Pablo Rodriguez

Dear list,

I have the following sample:

  \setupinteraction
      [state=start]

  \startJSpreamble varia used now
  this.pageNum = 0 ; // start at 0

  function GoToFirstSlide(label) {
  this.pageNum = 0 ;
  var rendition = this.media.getRendition(label) ;
  var player = app.media.openPlayer({
      rendition: rendition,
    });
  }

  function GoToLastSlide(label) {
    this.pageNum = this.numPages ;
  }

  function GoToNextSlide(label) {
      ++this.pageNum ;
  }

  function GoToPreviousSlide(label) {
      --this.pageNum ;
  }

  function SwitchFS() {
    if (app.fs.isFullScreen == true)
      app.fs.isFullScreen = false ;
    else
      app.fs.isFullScreen = true ;
  }
  \stopJSpreamble


  \setuppapersize[A9, landscape]

  \definefontfamily
      [mainface]
      [rm]
      [Latin Modern Sans]

  \definefontfamily
      [mainface]
      [ss]
      [Hans]

  \setupbodyfont
      [mainface, 25pt]

  \setupalign[middle]

  \setupfooter
      [style={\ss}]

  \def\SlideNavigationButtons{%
      \goto{A}[JS(GoToFirstSlide{mainsound})]%
      \goto{K}[JS(GoToPreviousSlide{mainsound})]%
      \goto{L}[JS(GoToNextSlide{mainsound})]%
      \goto{B}[JS(GoToLastSlide{mainsound})]
      \goto{{\ssb Q}}[JS(SwitchFS{})]%
      }

  \setupfootertexts[\SlideNavigationButtons]

  \starttext

    \definerenderingwindow[soundplace]
      [width=0pt, height=0pt]

    \useexternalrendering[mainsound][audio/mp3][sound.mp3][embed=yes]

    \placerenderingwindow[soundplace][mainsound]
  \dorecurse{25}{\null\page}
  \stoptext

I don’t know why I get the following message:

    TypeError: a.doc is undefined

It seems to be caused by "app.media.openPlayer", but the code is copied
from the documentation Adobe released early this year.

Does anyone know what is wrong here or what am I missing?

Many thanks for your help in advance,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-12 14:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-08 18:22 JavaScript in multimedia PDF Pablo Rodriguez via ntg-context
2021-08-08 21:00 ` Michal Vlasák via ntg-context
2021-08-09  6:32   ` Pablo Rodriguez via ntg-context
2021-08-10 21:52     ` Michal Vlasák via ntg-context
2021-08-11 13:59       ` Pablo Rodriguez via ntg-context
2021-08-11 20:40         ` Michal Vlasák via ntg-context
2021-08-11 22:55           ` Hans Hagen via ntg-context
2021-08-12  1:02             ` Michal Vlasák via ntg-context
2021-08-12 14:36               ` Pablo Rodriguez via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).