/* RealVideo Plugin - DMS - dec 99 - by Sylvain HUET */ /* rev April 00 - by Sebastien DENEUX */ /*to do - pauseAll */ typeof class=S;; fun cbcomm(ui, cli, action, param, z) = let z->[_ url pos _] in if (!strcmp action "url?") && url!=nil then UsendCli this cli ui "url" linebuild url::(if pos==nil then nil else itoa time-pos)::nil else nil ;; fun sendURL(a, b) = let b -> [ui url] in UsendCli this a ui "url" linebuild url::nil ;; fun startplay(o, url, z) = mutate z<-[_ url time _]; if !strcmpi hd UgetParam ObUi o "registeredClientsOnly" "yes" then let z -> [_ _ _ reg] in apply_on_list reg @sendURL [ObUi o url] /* send only to the clients that have registered */ else UsendCli this nil ObUi o "url" linebuild url::nil /* send to all clients */ ;; fun play(o, from, cli, action, param, rep, z) = startplay o param z ;; fun stop(o, from, cli, action, param, rep, z) = startplay o nil z ;; fun register(o, from, cli, action, param, rep, z) = let z -> [_ _ _ reg] in mutate z <- [_ _ _ cli::(remove_from_list reg cli)]; UsendCli this cli ObUi o "registered" nil ;; fun unregister(o, from, cli, action, param, rep, z) = let z -> [_ _ _ reg] in mutate z <- [_ _ _ (remove_from_list reg cli)]; UsendCli this cli ObUi o "url" nil; 0 ;; fun cbDelCli(o, cli, z) = let z -> [_ _ _ reg] in ( mutate z <- [_ _ _ (remove_from_list reg cli)]; 0 ) ;; fun newOb(o)= let [o (hd UgetParam ObUi o "init") nil nil] -> z in ( UcbComm this ObUi o mkfun5 @cbcomm z; ObRegisterAction o strcat ObName o ".playAll" mkfun7 @play z; ObRegisterAction o strcat ObName o ".stopAll" mkfun7 @stop z; /*ObRegisterAction o strcat ObName o ".pauseAll" mkfun7 @pause z;*/ if !strcmpi hd UgetParam ObUi o "registeredClientsOnly" "yes" then ( ObRegisterAction o strcat ObName o ".register" mkfun7 @register z; ObRegisterAction o strcat ObName o ".unregister" mkfun7 @unregister z ) else nil; OB_CBclientDestroyed o mkfun3 @cbDelCli z; 0 ) ;; fun IniPlug(file) = set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;