Hi Hans,

I wonder whether it would be possible to add these modified files to
ConTeXt.

These are needed to:

1. Deploy another SWF player.

2. Be able to stop the sound with a script, instead of being stopped
when leaving the page.

3. Add other FlashVars to the SWF player.

I don’t know whether this is the best approach. But I don’t see other
way to configure these things.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
%D \module
%D   [       file=java-imp-soundplayer,
%D        version=2019.10.14,
%D          title=\CONTEXT\ JavaScript Macros,
%D       subtitle=Shockwave Sound Support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D As part of the interaction manual writing this code was moved here. It's
%D kind of obsolete as shockwave is obsolete. Anywaym, here's how it works.
%D One can actually set all kind of properties but let's not waste time on
%D that. Maybe some day \PDF\ will have proper native video support.
%D
%D \starttyping
%D \starttext
%D
%D     \useJSscripts[soundplayer]
%D
%D     \setupinteraction
%D       [state=start]
%D
%D     \externalfigure
%D       [shockwave]
%D       [frame=on,
%D        width=480pt,
%D        height=270pt,
%D        file=sample.mp3,   % your file here
%D        label=foo]
%D
%D     \goto{START} [JS(StartShockwave{foo})]
%D     \goto{REWIND}[JS(RewindShockwave{foo})]
%D     \goto{PAUSE} [JS(PauseShockwave{foo})]
%D     \goto{STOP}  [JS(StopShockwave{foo})]
%D
%D \stoptext
%D \stoptyping

% using aplayer.swf from https://gitlab.com/agrahn/media9/:

\startluaparameterset[shockwave:display]
    toolbar  = true,
 -- preview  = "somefile",
    open     = "click",
    close    = "click", -- essential for playing after the page
\stopluaparameterset

\startJSpreamble shockwave used now

    function StartShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            // ok
        } else {
            rm.activated = true ;
        }
        rm.callAS("rewind") ;
        rm.callAS("playPause") ;
    }

    function StopShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("pause") ;
            rm.callAS("rewind") ;
        }
    }

    function RewindShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("rewind") ;
        }
    }

    function PauseShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("playPause") ;
        }
    }

\stopJSpreamble

\definereference[StartShockwave] [JS(StartShockwave)]
\definereference[StopShockwave]  [JS(StopShockwave)]
\definereference[RewindShockwave][JS(RewindShockwave)]
\definereference[PauseShockwave] [JS(PauseShockwave)]

\unprotect

\doglobal \useexternalfigure
  [shockwave]
  [aplayer.swf]
 
%[arguments=\luaparameterset{shockwave:arguments}{src="\externalfigureparameter\v!file",source="\externalfigureparameter\v!file"},
  
[\c!arguments=\luaparameterset{shockwave:arguments}{source="\externalfigureparameter\v!file",hideBar=true,autoPlay=true,volume=1},
   
\c!resources=\luaparameterset{shockwave:resources}{files={"\externalfigureparameter\v!file"}},
   \c!display=shockwave:display]

\protect \endinput
%D \module
%D   [       file=java-imp-splayer,
%D        version=2019.10.14,
%D          title=\CONTEXT\ JavaScript Macros,
%D       subtitle=Shockwave Sound Support,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D As part of the interaction manual writing this code was moved here. It's
%D kind of obsolete as shockwave is obsolete. Anywaym, here's how it works.
%D One can actually set all kind of properties but let's not waste time on
%D that. Maybe some day \PDF\ will have proper native video support.
%D
%D \starttyping
%D \starttext
%D
%D     \useJSscripts[splayer]
%D
%D     \setupinteraction
%D       [state=start]
%D
%D     \externalfigure
%D       [shockwave]
%D       [frame=on,
%D        width=480pt,
%D        height=270pt,
%D        file=sample.mp3,   % your file here
%D        label=foo]
%D
%D     \goto{START} [JS(StartShockwave{foo})]
%D     \goto{REWIND}[JS(RewindShockwave{foo})]
%D     \goto{PAUSE} [JS(PauseShockwave{foo})]
%D     \goto{STOP}  [JS(StopShockwave{foo})]
%D
%D \stoptext
%D \stoptyping

% using aplayer9.swf from https://gitlab.com/agrahn/media9/:

\startluaparameterset[shockwave:display]
    toolbar  = true,
 -- preview  = "somefile",
    open     = "click",
    close    = "click", -- essential for playing after the page
\stopluaparameterset

\startJSpreamble shockwave used now

    function StartShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            // ok
        } else {
            rm.activated = true ;
        }
        rm.callAS("rewind") ;
        rm.callAS("playPause") ;
    }

    function StopShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("pause") ;
            rm.callAS("rewind") ;
        }
    }

    function RewindShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("rewind") ;
        }
    }

    function PauseShockwave(label) {
        var rm = this.getAnnotsRichMedia(this.pageNum,label)[0] ;
        if (rm.activated) {
            rm.callAS("playPause") ;
        }
    }

\stopJSpreamble

\definereference[StartShockwave] [JS(StartShockwave)]
\definereference[StopShockwave]  [JS(StopShockwave)]
\definereference[RewindShockwave][JS(RewindShockwave)]
\definereference[PauseShockwave] [JS(PauseShockwave)]

\unprotect

\doglobal \useexternalfigure
  [shockwave]
  [aplayer9.swf]
 
%[arguments=\luaparameterset{shockwave:arguments}{src="\externalfigureparameter\v!file",source="\externalfigureparameter\v!file"},
  
[\c!arguments=\luaparameterset{shockwave:arguments}{source="\externalfigureparameter\v!file",hideBar=true,autoPlay=true,volume=1},
   
\c!resources=\luaparameterset{shockwave:resources}{files={"\externalfigureparameter\v!file"}},
   \c!display=shockwave:display]

\protect \endinput
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-context

Reply via email to