ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: JavaScript in multimedia PDF
Date: Sun, 8 Aug 2021 20:22:56 +0200	[thread overview]
Message-ID: <0e6922fe-35f8-8542-3ee2-8739fd6e2949@gmx.es> (raw)

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
___________________________________________________________________________________

             reply	other threads:[~2021-08-08 18:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 18:22 Pablo Rodriguez via ntg-context [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e6922fe-35f8-8542-3ee2-8739fd6e2949@gmx.es \
    --to=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).