1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: class JWFLVmediaplayer {
15:
16: var $playerUrl = "";
17: var $divName = "placeholder";
18:
19:
20: var $allowfullscreen = true;
21: var $allowscriptaccess = "always";
22: var $menu = false ;
23: var $mode = "opaque";
24:
25:
26:
27:
28:
29: var $height = "320";
30: var $width = "650";
31:
32: var $file = "";
33: var $image = "";
34: var $id = "";
35: var $searchbar = false;
36:
37:
38:
39: var $backcolor = "";
40: var $frontcolor = "0x000000";
41: var $lightcolor = "";
42: var $screencolor = "0x000000";
43:
44: var $logo = "";
45: var $overstretch = false ;
46: var $showicons = true;
47: var $transition = "random";
48:
49: var $shownavigation = true;
50: var $showstop = false ;
51: var $showdigits = true;
52: var $showdownload = false ;
53: var $usefullscreen = true;
54:
55: var $autoscroll = false ;
56: var $displayheight = "400";
57: var $displaywidthembed = false ;
58: var $displaywidth = "400";
59: var $thumbsinplaylist = true;
60:
61: var $audio = "";
62: var $autostart = false ;
63: var $bufferlength = "3";
64: var $captions = "";
65: var $fallback = "";
66: var $repeat = false ;
67: var $rotatetime = "5";
68: var $shuffle = false ;
69: var $volume = "80";
70:
71: var $callback = "";
72: var $enablejs = false ;
73: var $javascriptid = "";
74: var $link = "";
75: var $linkfromdisplay = false ;
76: var $linktarget = "_self";
77: var $recommendations = "";
78: var $streamscript = "";
79: var $type = "";
80:
81:
82:
83: function setPlayerUrl($playerUrl)
84: {
85: $this -> playerUrl = $playerUrl;
86: }
87:
88:
89: function setDivName($divName)
90: {
91: $this -> divName = $divName;
92: }
93:
94:
95:
96:
97:
98: function setDisableAllowfullscreen()
99: {
100: $this -> allowfullscreen = false;
101: }
102:
103:
104:
105:
106:
107:
108: function setHeight($height)
109: {
110: $this -> height = $height;
111: }
112:
113:
114: function setWidth($width)
115: {
116: $this -> width = $width;
117: }
118:
119:
120:
121: function setFile($type)
122: {
123: $this -> file = $type;
124: }
125:
126:
127:
128: function setImage($image)
129: {
130: $this -> image = $image ;
131: }
132:
133:
134:
135: function setId($id)
136: {
137: $this -> id = $id ;
138: }
139:
140:
141: function setEnableSearchbar()
142: {
143: $this -> searchbar = true;
144: }
145:
146:
147:
148:
149:
150:
151:
152:
153: function setBackcolor($backcolor)
154: {
155: $this -> backcolor = $backcolor ;
156: }
157:
158:
159: function setFrontcolor($frontcolor)
160: {
161: $this -> frontcolor = $frontcolor ;
162: }
163:
164:
165: function setLightcolor($lightcolor)
166: {
167: $this -> lightcolor = $lightcolor ;
168: }
169:
170:
171:
172: function setScreencolor($screencolor)
173: {
174: $this -> screencolor = $screencolor ;
175: }
176:
177:
178:
179:
180:
181:
182:
183: function setLogo($logo)
184: {
185: $this -> logo = $logo ;
186: }
187:
188:
189: function setEnableOverstretch()
190: {
191: $this -> overstretch = true;
192: }
193:
194:
195:
196: function setDisableShowicons()
197: {
198: $this -> showicons = false;
199: }
200:
201:
202:
203:
204:
205:
206: function setTransition($type)
207: {
208: switch ($type) {
209: case 'fade':
210: $this -> transition = "fade" ;
211: break;
212: case 'bgfade':
213: $this -> transition = "bgfade" ;
214: break;
215: case 'blocks':
216: $this -> transition = "blocks" ;
217: break;
218: case 'bubbles':
219: $this -> transition = "bubbles" ;
220: break;
221: case 'circles':
222: $this -> transition = "circles" ;
223: break;
224: case 'flash':
225: $this -> transition = "flash" ;
226: break;
227: case 'fluids':
228: $this -> transition = "fluids" ;
229: break;
230: case 'lines':
231: $this -> transition = "lines" ;
232: break;
233: case 'slowfade':
234: $this -> transition = "slowfade" ;
235: break;
236: case 'random':
237: default:
238: $this -> transition = "random" ;
239: break;
240: }
241: }
242:
243:
244:
245:
246: function setDisableShownavigation()
247: {
248: $this -> shownavigation = false;
249: }
250:
251: function setEnableShowstop()
252: {
253: $this -> showstop = true;
254: }
255:
256: function setDisableShowdigits()
257: {
258: $this -> showdigits = false;
259: }
260:
261: function setEnableShowdownload()
262: {
263: $this -> showdownload = true;
264: }
265:
266: function setDisableUsefullscreen()
267: {
268: $this -> usefullscreen = false;
269: }
270:
271:
272:
273:
274: function setEnableAutoscroll()
275: {
276: $this -> autoscroll = true;
277: }
278:
279: function setDisplayheight($displayheight)
280: {
281: $this -> displayheight = $displayheight ;
282: }
283:
284: function setDisplaywidth($embed, $displaywidth)
285: {
286: $this -> displaywidthembed = $embed ;
287: $this -> displaywidth = $displaywidth ;
288: }
289:
290: function setDisableThumbsinplaylist()
291: {
292: $this -> thumbsinplaylist = false;
293: }
294:
295:
296:
297:
298: function setAudio($audio)
299: {
300: $this -> audio = $audio ;
301: }
302:
303: function setEnableAutostart()
304: {
305: $this -> autostart = true;
306: }
307:
308: function setBufferlength($bufferlength)
309: {
310: $this -> bufferlength = $bufferlength ;
311: }
312:
313: function setCaptions($captions)
314: {
315: $this -> captions = $captions ;
316: }
317:
318: function setFallback($fallback)
319: {
320: $this -> fallback = $fallback ;
321: }
322:
323:
324:
325:
326:
327:
328:
329:
330: function setRepeat($repeat)
331: {
332: $this -> repeat = $repeat ;
333: }
334:
335:
336: function setRotatetime($rotatetime)
337: {
338: $this -> rotatetime = $rotatetime ;
339: }
340:
341: function setEnableShuffle()
342: {
343: $this -> shuffle = true;
344: }
345:
346: function setVolume($volume)
347: {
348: $this -> volume = $volume ;
349: }
350:
351:
352:
353:
354: function setCallback($callback)
355: {
356: $this -> callback = $callback ;
357: }
358:
359: function setEnableEnablejs()
360: {
361: $this -> enablejs = true;
362: }
363:
364: function setJavascriptid($javascriptid)
365: {
366: $this -> javascriptid = $javascriptid ;
367: }
368:
369: function setLink ($link )
370: {
371: $this -> link = $link ;
372: }
373:
374: function setEnableLinkfromdisplay()
375: {
376: $this -> linkfromdisplay = true;
377: }
378:
379: function setLinktarget($linktarget)
380: {
381: $this -> linktarget = $linktarget ;
382: }
383:
384: function setRecommendations($recommendations)
385: {
386: $this -> recommendations = $recommendations ;
387: }
388:
389: function setStreamscript($streamscript)
390: {
391: $this -> streamscript = $streamscript ;
392: }
393:
394: function setType($type)
395: {
396: $this -> type = $type ;
397: }
398:
399:
400:
401:
402:
403:
404:
405:
406:
407: function GetPlayer() {
408: $_output = '<!-- '. "\n";
409: $_output.= 'JW FLVmediaplayer v3.15'. "\n";
410: $_output.= 'http://www.jeroenwijering.com/?item=JW_FLV_Media_Player'. "\n";
411: $_output.= 'JW FLVmediaplayer.class.php v0.1'. "\n";
412: $_output.= 'http://beabo.net/'. "\n";
413: $_output.= '-->'. "\n";
414:
415: $_output.= '<div id="'.$this -> divName.'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>'. "\n";
416: $_output.= '<script type="text/javascript" src="swfobject.js"></script>'. "\n";
417: $_output.= '<script type="text/javascript">'. "\n";
418: $_output.= ' var s1 = new SWFObject("mediaplayer.swf","mediaplayer","'.$this -> width.'","'.$this -> height.'","7");'. "\n";
419: if ($this -> allowfullscreen) {
420: $allowfullscreen = "true";
421: } else {
422: $allowfullscreen = "false";
423: }
424:
425: $_output.= ' s1.addParam("allowfullscreen","'.$allowfullscreen. '");'. "\n";
426: $_output.= ' s1.addParam("allowscriptaccess","always");'. "\n";
427: $_output.= ' s1.addParam("wmode","opaque");'. "\n";
428:
429: $_output.= ' s1.addVariable("shuffle","'. $this -> shuffle. '");'. "\n";
430: if ($this -> linkfromdisplay) $_output.= ' s1.addVariable("linkfromdisplay","true");'. "\n";
431: if ($this -> displaywidthembed) $_output.= ' s1.addVariable("displaywidth","'. $this -> displaywidth.'"); '. "\n";
432: if ($this -> autoscroll) $_output.= ' s1.addVariable("autoscroll","true");'. "\n";
433: if ($this -> repeat) $_output.= ' s1.addVariable("repeat","'. $this -> repeat . '");'. "\n";
434: if ($this -> image) $_output.= ' s1.addVariable("image","'.$this -> image.'");'. "\n";
435: if ($this -> logo) $_output.= ' s1.addVariable("logo","'.$this -> logo.'");'. "\n";
436: if ($this -> recommendations ) $_output.= ' s1.addVariable("recommendations","'. $this -> recommendations. '");'. "\n";
437: if ($this -> lightcolor) $_output.= ' s1.addVariable("lightcolor","'. $this -> lightcolor . '");'. "\n";
438: if ($this -> backcolor) $_output.= ' s1.addVariable("bgcolor","'. $this -> backcolor . '");'. "\n";
439: $_output.= ' s1.addVariable("file","'.$this -> file.'");'. "\n";
440: $_output.= ' s1.addVariable("width","'.$this -> width.'");'. "\n";
441: $_output.= ' s1.addVariable("height","'.$this -> height.'");'. "\n";
442:
443: $_output.= ' s1.write("'.$this -> divName.'");'. "\n";
444:
445:
446: $_output.= '</script>'. "\n";
447: return $_output;
448: }
449:
450:
451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471:
472:
473:
474:
475:
476: function embedPlayer() {
477: $_output = '<embed '. "\n";
478:
479: if ($this -> playerUrl) {
480: $_output.= 'src="'.$this -> playerUrl.'mediaplayer.swf" '. "\n";
481: } else {
482: $_output.= 'src="mediaplayer.swf" '. "\n";
483: }
484: $_output.= 'width="'. $this -> width.'" '. "\n";
485: $_output.= 'height="'. $this -> height.'"'. "\n";
486: $_output.= 'allowscriptaccess="'. $this ->allowscriptaccess. '" '. "\n";
487: if ($this -> allowfullscreen) {
488: $allowfullscreen = "true";
489: } else {
490: $allowfullscreen = "false";
491: }
492: $_output.= 'allowfullscreen="'.$allowfullscreen. '" '. "\n";
493: $_output.= 'flashvars="width='.$this -> width.'&height='.$this -> height.'&file='.$this -> file ;
494:
495: if ($this -> image) {
496: $_output.= '&image='.$this -> image ;
497: }
498:
499:
500:
501:
502:
503: if ($this -> searchbar) {
504: $_output.= '&searchbar='.$this -> searchbar ;
505: }
506:
507: $_output.= '" />'. "\n";
508:
509:
510:
511: return $_output;
512: }
513:
514: }
515: ?>