On 8/8/21 11:00 PM, Michal Vlasák via ntg-context wrote:
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)?
Well, the link you provided (https://mailman.ntg.nl/pipermail/ntg-context/2021/103023.html) is from February 2021: https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_... Here is the guide to developers (from the same date): https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_...
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();
I get exactly the same results: screen object, but null rendition. I have no idea what it is needed here. Many thanks for your help, Pablo -- http://www.ousia.tk