On Sun Aug 8, 2021 at 8:22 PM CEST, Pablo Rodriguez via ntg-context wrote:
> 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.

Is there a newer document than "JavaScript for Acrobat API Reference"
(May 2015)?

Anyways, I thought that the culprit is that you only specify the
rendition (what to play) and not screen (where to play):


     function GoToFirstSlide(label) {
     this.pageNum = 0 ;
     var rendition = this.media.getRendition(label) ;
    +var screen = this.media.getAnnots({ nPage: 0})[0];
     var player = app.media.openPlayer({
         rendition: rendition,
    +    annot: screen,
       });
     }

But as it turns out, while the screen query succesfully returns an
object, the rendition query returns null.

The PDF 1.7 standard specifies that the name (/N) of Rendition PDF
object should be Unicode, but that doesn't seem to make it work either,
as does deleting the name of the media clip (which was the same).

(But I now get "Invalid arguments" error for the "app.media.openPlayer"
call, which is kind of expected.)

Can you confirm, that "rendition" is null on your side as well?

    console.println(rendition);
    console.println(screen);
    console.show();


Michal Vlasák
___________________________________________________________________________________
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 via email to