-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathembed_video.tex
71 lines (71 loc) · 1.82 KB
/
embed_video.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
\usepackage[bigfiles]{pdfbase}
\ExplSyntaxOn
\NewDocumentCommand\embedvideo{smm}{
\group_begin:
\leavevmode
\tl_if_exist:cTF{file_\file_mdfive_hash:n{#3}}{
\tl_set_eq:Nc\video{file_\file_mdfive_hash:n{#3}}
}{
\IfFileExists{#3}{}{\GenericError{}{File~`#3'~not~found}{}{}}
\pbs_pdfobj:nnn{}{fstream}{{}{#3}}
\pbs_pdfobj:nnn{}{dict}{
/Type/Filespec/F~(#3)/UF~(#3)
/EF~<</F~\pbs_pdflastobj:>>
}
\tl_set:Nx\video{\pbs_pdflastobj:}
\tl_gset_eq:cN{file_\file_mdfive_hash:n{#3}}\video
}
%
\pbs_pdfobj:nnn{}{dict}{
/Type/RichMediaInstance/Subtype/Video
/Asset~\video
/Params~<</FlashVars (
source=#3&
skin=SkinOverAllNoFullNoCaption.swf&
skinAutoHide=true&
skinBackgroundColor=0x5F5F5F&
skinBackgroundAlpha=0
)>>
}
%
\pbs_pdfobj:nnn{}{dict}{
/Type/RichMediaConfiguration/Subtype/Video
/Instances~[\pbs_pdflastobj:]
}
%
\pbs_pdfobj:nnn{}{dict}{
/Type/RichMediaContent
/Assets~<<
/Names~[(#3)~\video]
>>
/Configurations~[\pbs_pdflastobj:]
}
\tl_set:Nx\rmcontent{\pbs_pdflastobj:}
%
\pbs_pdfobj:nnn{}{dict}{
/Activation~<<
/Condition/\IfBooleanTF{#1}{PV}{XA}
/Presentation~<</Style/Embedded>>
>>
/Deactivation~<</Condition/PI>>
}
%
\hbox_set:Nn\l_tmpa_box{#2}
\tl_set:Nx\l_box_wd_tl{\dim_use:N\box_wd:N\l_tmpa_box}
\tl_set:Nx\l_box_ht_tl{\dim_use:N\box_ht:N\l_tmpa_box}
\tl_set:Nx\l_box_dp_tl{\dim_use:N\box_dp:N\l_tmpa_box}
\pbs_pdfxform:nnnnn{1}{1}{}{}{\l_tmpa_box}
%
\pbs_pdfannot:nnnn{\l_box_wd_tl}{\l_box_ht_tl}{\l_box_dp_tl}{
/Subtype/RichMedia
/BS~<</W~0/S/S>>
/Contents~(embedded~video~file:#3)
/NM~(rma:#3)
/AP~<</N~\pbs_pdflastxform:>>
/RichMediaSettings~\pbs_pdflastobj:
/RichMediaContent~\rmcontent
}
\phantom{#2}
\group_end:
}
\ExplSyntaxOff