/*RealPlayer Module - DMS - April 99 - by Vincent BEAUDENON */ typeof win =ObjWin;; typeof buf =ObjBitmap;; typeof player =RealStream;; typeof font=ObjFont;; typeof larg =I;; typeof haut =I;; typeof X =I;; typeof Y =I;; typeof state=I;; typeof bitmapW=I;; typeof bitmapH=I;; proto startplay=fun[Timer S] I;; defcom Cregister=register;; fun cb(x,y)= REALblit buf x; _STBLTbitmap win 0 0 larg haut buf 0 0 bitmapW bitmapH; 0;; fun disptxt(s)= _DRAWrectangle buf 0 bitmapH-20 bitmapW bitmapH DRAW_SOLID 0 0x00ffffff DRAW_SOLID 0x00ffffff; _DRAWtext buf font bitmapW/2 bitmapH-5 TD_BASELINE|TD_CENTER 0 s; _STBLTbitmap win 0 0 larg haut buf 0 0 bitmapW bitmapH; 0;; fun cbstate(b,z,s)= match s with (RealBuffering i ->disptxt strcat strcat "buffering " itoa i "%") |(RealContacting s ->disptxt "...contacting...") |(RealOnBegin ->disptxt "begin") |(RealOnPause ->disptxt "pause") |(RealOnStop ->disptxt "stop") |(RealOnClosed ->disptxt "closed") |(RealOnOpened ->disptxt "opened") ;0;; fun startplay (a,url)= REALdestroy player; set player=REALcbState REALcbImage REALcreate _channel url @cb nil @cbstate 0; if player==nil then (disptxt "cannot find RealPlayer";nil) else REALcbState REALcbImage player @cb nil @cbstate 0; 0;; fun _resize(x,s)= let x->[wn x y w h] in ( _SIZEwindow win w h x y; set X=x;set Y=y; set haut=h; set larg=w; _STBLTbitmap win 0 0 larg haut buf 0 0 bitmapW bitmapH );0;; fun destroy()= REALdestroy player; 0;; fun _destroy(win,a)=destroy;; fun _onconflict(a)=destroy;_DMSreleaseZone this a;0;; fun pause()=REALpause player; disptxt "pause";0;; fun replay()=REALplay player; 0;; fun switch()=if state==1 then (pause; set state=0) else (replay; set state=1); 0;; fun _clicked(a,b,c,d,e)=switch;; fun _repaint(a,b)= _STBLTbitmap win 0 0 larg haut buf 0 0 bitmapW bitmapH; 0;; fun _playC(url)= let _DMSgetZone this "interfaceC" @_onconflict @_resize nil ->[wn x y w h] in if wn==nil then nil else ( set larg=w; set haut=h; set X=x; set Y=y; set win=_CRwindow _channel wn X Y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER ""; set state=1; _CBwinClick win @_clicked nil; _CBwinPaint win @_repaint nil; startplay nil url; ); 0;; fun __play(param)= _playC param; 0;; fun _seek()=REALseek player 10000;; fun _mute()=REALsetMute player !REALgetMute player;; fun _low()=REALsetVolume player 100-REALgetVolume player;; fun activate(from,action,param,rep)= if !strcmp action "play" then (_playC param;0) else if !strcmp action "stop" then (destroy ;0) else if !strcmp action "pause" then (switch ;0) else if !strcmp action "seek" then (_seek ;0) else if !strcmp action "mute" then (_mute ;0) else if !strcmp action "low" then (_low ;0) else nil;; fun IniDMI(file)= _DMSregisterDMI this @activate @destroy; _DMSsend this Cregister []; set bitmapW=256; set bitmapH=256; set font = _CRfont _channel 14 0 FF_PIXEL "Courier New"; set buf=_CRbitmap _channel bitmapW bitmapH; 0;;