Removing an old, cherished, yet pointless caveat "This documentation is
[supercollider.git] / Help / GUI / Cocoa-GUI / SCMovieView.html
blob28e472bc158ab6c517fee6768bceb156ea7beb4c
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.43">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 9.0px Monaco; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica; min-height: 14.0px}
17 p.p8 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica}
18 p.p9 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica}
19 p.p10 {margin: 0.0px 0.0px 0.0px 85.0px; text-indent: -85.0px; font: 12.0px Helvetica; min-height: 14.0px}
20 p.p11 {margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 14.0px Helvetica; min-height: 17.0px}
21 p.p12 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
22 p.p13 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #a41c14}
23 p.p14 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
24 span.s1 {font: 18.0px Helvetica}
25 span.s2 {color: #1638e6}
26 span.s3 {color: #6f7178}
27 span.s4 {color: #0c2eee}
28 span.s5 {color: #0018b8}
29 span.s6 {color: #606060}
30 span.s7 {color: #000000}
31 span.s8 {color: #a41c14}
32 span.s9 {color: #8d261b}
33 span.Apple-tab-span {white-space:pre}
34 </style>
35 </head>
36 <body>
37 <p class="p1"><span class="s1"><b>SCMovieView<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b></span><b>a wrapper for a Cocoa Quicktime view</b><span class="s1"><b><span class="Apple-tab-span"> </span></b></span></p>
38 <p class="p2"><br></p>
39 <p class="p1"><b>Inherits from: </b><a href="../../Core/Object.html"><span class="s2"><b>Object</b></span></a><b> : </b><a href="SCView.html"><span class="s2"><b>SCView</b></span></a></p>
40 <p class="p3"><br></p>
41 <p class="p1">SCMovieView can play movies such as .mov and mpg,</p>
42 <p class="p1">and image files like jpg, png, tiff and others.</p>
43 <p class="p2"><br></p>
44 <p class="p1"><b>See also: </b><a href="SCImage/SCImage.html"><span class="s2">SCImage</span></a></p>
45 <p class="p2"><br></p>
46 <p class="p4"><b>Creation / Class Methods</b></p>
47 <p class="p5"><br></p>
48 <p class="p6"><b><span class="Apple-tab-span"> </span>*new (parent, bounds)</b></p>
49 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
50 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>parent </b>- The parent view.</p>
51 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bounds </b>- An instance of <a href="../../Geometry/Rect.html"><span class="s3">Rect</span></a>, or a <a href="../../Geometry/Point.html"><span class="s3">Point</span></a> indicating width@height.</p>
52 <p class="p5"><br></p>
53 <p class="p9"><b>Accessing Instance and Class Variables</b></p>
54 <p class="p7"><span class="Apple-tab-span"> </span></p>
55 <p class="p6"><b><span class="Apple-tab-span"> </span>path</b></p>
56 <p class="p6"><b><span class="Apple-tab-span"> </span>path_ (moviePath)</b></p>
57 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
58 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>moviePath </b>- The path to the movie.</p>
59 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
60 <p class="p9"><b>Movie Control</b></p>
61 <p class="p7"><span class="Apple-tab-span"> </span></p>
62 <p class="p6"><b><span class="Apple-tab-span"> </span>start</b></p>
63 <p class="p6"><b><span class="Apple-tab-span"> </span>stop</b></p>
64 <p class="p6"><b><span class="Apple-tab-span"> </span>stepForward</b></p>
65 <p class="p6"><b><span class="Apple-tab-span"> </span>stepBack</b></p>
66 <p class="p6"><b><span class="Apple-tab-span"> </span>gotoEnd</b></p>
67 <p class="p6"><span class="Apple-tab-span"> </span><b>gotoBeginning</b></p>
68 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
69 <p class="p6"><b><span class="Apple-tab-span"> </span>frame_ (frameIdx)</b></p>
70 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
71 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Go to frame.</p>
72 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>frameIdx </b>- An integer.</p>
73 <p class="p7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
74 <p class="p6"><b><span class="Apple-tab-span"> </span>playSelectionOnly_ (bool)</b></p>
75 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
76 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
77 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
78 <p class="p6"><b><span class="Apple-tab-span"> </span>skipFrames (numFrames)</b></p>
79 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
80 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>numFrames </b>- An Integer.</p>
81 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
82 <p class="p6"><b><span class="Apple-tab-span"> </span>muted</b></p>
83 <p class="p6"><b><span class="Apple-tab-span"> </span>muted_ (bool)</b></p>
84 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
85 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
86 <p class="p10"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
87 <p class="p6"><b><span class="Apple-tab-span"> </span>loopMode</b></p>
88 <p class="p6"><b><span class="Apple-tab-span"> </span>loopMode_ (mode)</b></p>
89 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
90 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>mode </b>- An Integer . Loop modes:</p>
91 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>0 Playback runs forward and backward between both endpoints.</p>
92 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>1 Restarts playback at beginning when end is reached.</p>
93 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>2 Playback stops when end is reached.<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
94 <p class="p10"><br></p>
95 <p class="p6"><b><span class="Apple-tab-span"> </span>rate</b></p>
96 <p class="p6"><b><span class="Apple-tab-span"> </span>rate_ (ratein)</b></p>
97 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
98 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>ratein </b>- An instance of <a href="../../Math/Float.html"><span class="s4">Float</span></a>. 1.0 is the normal rate.</p>
99 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
100 <p class="p9"><b>Movie Editing</b></p>
101 <p class="p11"><br></p>
102 <p class="p6"><b><span class="Apple-tab-span"> </span>copy</b></p>
103 <p class="p6"><b><span class="Apple-tab-span"> </span>clear</b></p>
104 <p class="p6"><b><span class="Apple-tab-span"> </span>cut</b></p>
105 <p class="p6"><b><span class="Apple-tab-span"> </span>paste</b></p>
106 <p class="p7"><br></p>
107 <p class="p6"><b><span class="Apple-tab-span"> </span>editable</b></p>
108 <p class="p6"><b><span class="Apple-tab-span"> </span>editable_ (bool)</b></p>
109 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
110 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
111 <p class="p5"><br></p>
112 <p class="p6"><b><span class="Apple-tab-span"> </span>currentTime</b></p>
113 <p class="p6"><b><span class="Apple-tab-span"> </span>currentTime_ (time)</b></p>
114 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
115 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Get/set the current time.</p>
116 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>time </b>- Default value is nil. .</p>
117 <p class="p5"><br></p>
118 <p class="p9"><b>Adjusting Appearance</b></p>
119 <p class="p11"><br></p>
120 <p class="p6"><b><span class="Apple-tab-span"> </span>showControllerAndAdjustSize (show, adjust)</b></p>
121 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
122 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>show </b>- An instance of Boolean. Default is true.</p>
123 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>adjust </b>- An instance of Boolean. Default is true.</p>
124 <p class="p5"><br></p>
125 <p class="p6"><b><span class="Apple-tab-span"> </span>resizeWithMagnification (size)</b></p>
126 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
127 <p class="p6"><b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></b>Resizes the whole view, adjusts its contents.</p>
128 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>size </b>- An instance of <a href="../../Math/Float.html"><span class="s2">Float</span></a>.</p>
129 <p class="p5"><br></p>
130 <p class="p6"><b><span class="Apple-tab-span"> </span>fixedAspectRatio_ (bool)</b></p>
131 <p class="p7"><b><span class="Apple-tab-span"> </span></b></p>
132 <p class="p8"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>bool </b>- An instance of <a href="../../Core/Boolean.html"><span class="s2">Boolean</span></a>.</p>
133 <p class="p5"><br></p>
134 <p class="p9"><b>Examples</b></p>
135 <p class="p3"><br></p>
136 <p class="p12">(</p>
137 <p class="p12">w = <span class="s5">Window</span>(<span class="s6">"mov"</span>).front;</p>
138 <p class="p12">b = <span class="s5">Button</span>(w, <span class="s5">Rect</span>(0, 0, 150, 20))</p>
139 <p class="p12"><span class="Apple-tab-span"> </span>.states_([[<span class="s6">"pick a file"</span>]])</p>
140 <p class="p12"><span class="Apple-tab-span"> </span>.action_({ <span class="s5">File</span>.openDialog(<span class="s6">""</span>, { <span class="s5">|path|</span> m.path_(path) }) });</p>
141 <p class="p12">m = <span class="s5">MovieView</span>(w, <span class="s5">Rect</span>(0,20,360, 260));</p>
142 <p class="p12">)</p>
143 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// random-pick a tiff from the Help folder</p>
144 <p class="p12">m.path_(<span class="s6">"Help/*/*/*.tiff"</span>.pathMatch.choose);</p>
145 <p class="p3"><br></p>
146 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// or point it to a movie (you may have that one too):</p>
147 <p class="p14"><span class="s7">m.path_(</span>"/Library/Application\ Support/iDVD/Tutorial/Movies/Our\ First\ Snowman.mov"<span class="s7">);</span></p>
148 <p class="p3"><br></p>
149 <p class="p3"><br></p>
150 <p class="p12">m.start;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s8">// playback</span></p>
151 <p class="p12">m.muted_(<span class="s5">false</span>);<span class="Apple-tab-span"> </span><span class="s8">// thank god</span></p>
152 <p class="p12">m.stop;<span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
153 <p class="p3"><span class="Apple-tab-span"> </span></p>
154 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>//rate</p>
155 <p class="p12">m.rate_(1);<span class="Apple-tab-span"> </span></p>
156 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// backwards</p>
157 <p class="p12">m.gotoEnd.rate_(-1).start;</p>
158 <p class="p3"><br></p>
159 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// select a range on the controller and play it</p>
160 <p class="p12">m.rate_(1).playSelectionOnly_(<span class="s5">true</span>).start;</p>
161 <p class="p3"><br></p>
162 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// loopModes:</p>
163 <p class="p13"><span class="s7">m.loopMode_(1);<span class="Apple-tab-span"> </span></span>// only one direction</p>
164 <p class="p12">m.loopMode_(0).start;<span class="Apple-tab-span"> </span><span class="s8">// back and forth</span></p>
165 <p class="p3"><br></p>
166 <p class="p3"><br></p>
167 <p class="p3"><br></p>
168 <p class="p12">m.stop;</p>
169 <p class="p12">m.gotoBeginning;</p>
170 <p class="p3"><span class="Apple-tab-span"> </span></p>
171 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// single steps</p>
172 <p class="p12">m.stepForward;</p>
173 <p class="p3"><br></p>
174 <p class="p12">10.do { m.stepForward; };</p>
175 <p class="p12">m.stepBack;</p>
176 <p class="p3"><br></p>
177 <p class="p13">// select with shift-drag, copy paste between movieviews or quicktime player</p>
178 <p class="p12">m.editable_(<span class="s5">true</span>);</p>
179 <p class="p3"><br></p>
180 <p class="p3"><br></p>
181 <p class="p12">m.showControllerAndAdjustSize(<span class="s5">true</span>, <span class="s5">true</span>);</p>
182 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>// resize compared to image size:</p>
183 <p class="p12">m.resizeWithMagnification(0.25);<span class="Apple-tab-span"> </span></p>
184 <p class="p3"><br></p>
185 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span></span>//goto time (in seconds)</p>
186 <p class="p12">m.currentTime_(1);</p>
187 <p class="p3"><br></p>
188 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// not there yet, but would be nice to have:</p>
189 <p class="p13"><span class="s7"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// startFrame, length</p>
190 <p class="p12">m.setSelection_(20, 15);</p>
191 <p class="p3"><br></p>
192 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
193 <p class="p12">m.frame_(frame);<span class="Apple-tab-span"> </span><span class="s8">// jump to frame</span></p>
194 <p class="p12">m.frame.postln;<span class="Apple-tab-span"> </span><span class="s8">// poll current</span><span class="s9"> frame pos</span></p>
195 <p class="p3"><br></p>
196 </body>
197 </html>