001package Torello.Browser;
002
003import java.util.*;
004import javax.json.*;
005import javax.json.stream.*;
006import java.io.*;
007
008import java.lang.reflect.Method;
009import java.lang.reflect.Parameter;
010import java.util.function.Function;
011
012import Torello.Java.Additional.*;
013import Torello.Java.JSON.*;
014
015import static Torello.Java.JSON.JFlag.*;
016
017import Torello.Java.StrCmpr;
018import Torello.JavaDoc.StaticFunctional;
019import Torello.JavaDoc.JDHeaderBackgroundImg;
020import Torello.JavaDoc.Excuse;
021
022/**
023 * <SPAN CLASS=COPIEDJDK><B>This domain allows detailed inspection of media elements</B></SPAN>
024 * 
025 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
026 */
027@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
028@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
029public class Media
030{
031    // ********************************************************************************************
032    // ********************************************************************************************
033    // Class Header Stuff
034    // ********************************************************************************************
035    // ********************************************************************************************
036
037
038    // No Pubic Constructors
039    private Media () { }
040
041    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
042    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
043    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
044    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
045
046    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
047    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
048    // offically, two empty-vectors.  One for String's, and the other for Classes.
049
050    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
051    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
052
053    static
054    {
055        for (Method m : Media.class.getMethods())
056        {
057            // This doesn't work!  The parameter names are all "arg0" ... "argN"
058            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
059            //
060            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
061
062            Vector<Class<?>> parameterTypesList = new Vector<>();
063        
064            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
065
066            parameterTypes.put(
067                m.getName(),
068                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
069            );
070        }
071    }
072
073    static
074    {
075        Vector<String> v = null;
076
077        parameterNames.put("enable", EMPTY_VEC_STR);
078
079        parameterNames.put("disable", EMPTY_VEC_STR);
080    }
081
082
083    // ********************************************************************************************
084    // ********************************************************************************************
085    // Types - Static Inner Classes
086    // ********************************************************************************************
087    // ********************************************************************************************
088
089    // public static class PlayerId => String
090    
091    // public static class Timestamp => Number
092    
093    /**
094     * Have one type per entry in MediaLogRecord::Type
095     * Corresponds to kMessage
096     */
097    public static class PlayerMessage
098        extends BaseType
099        implements java.io.Serializable
100    {
101        /** For Object Serialization.  java.io.Serializable */
102        protected static final long serialVersionUID = 1;
103        
104        public boolean[] optionals()
105        { return new boolean[] { false, false, }; }
106        
107        /**
108         * Keep in sync with MediaLogMessageLevel
109         * We are currently keeping the message level 'error' separate from the
110         * PlayerError type because right now they represent different things,
111         * this one being a DVLOG(ERROR) style log message that gets printed
112         * based on what log level is selected in the UI, and the other is a
113         * representation of a media::PipelineStatus object. Soon however we're
114         * going to be moving away from using PipelineStatus for errors and
115         * introducing a new error type which should hopefully let us integrate
116         * the error log level into the PlayerError type.
117         */
118        public final String level;
119        
120        /** <CODE>[No Description Provided by Google]</CODE> */
121        public final String message;
122        
123        /**
124         * Constructor
125         *
126         * @param level 
127         * Keep in sync with MediaLogMessageLevel
128         * We are currently keeping the message level 'error' separate from the
129         * PlayerError type because right now they represent different things,
130         * this one being a DVLOG(ERROR) style log message that gets printed
131         * based on what log level is selected in the UI, and the other is a
132         * representation of a media::PipelineStatus object. Soon however we're
133         * going to be moving away from using PipelineStatus for errors and
134         * introducing a new error type which should hopefully let us integrate
135         * the error log level into the PlayerError type.
136         * <BR />Acceptable Values: ["error", "warning", "info", "debug"]
137         * 
138         * @param message -
139         */
140        public PlayerMessage(String level, String message)
141        {
142            // Exception-Check(s) to ensure that if any parameters which are not declared as
143            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
144            
145            if (level == null)   BRDPC.throwNPE("level");
146            if (message == null) BRDPC.throwNPE("message");
147            
148            // Exception-Check(s) to ensure that if any parameters which must adhere to a
149            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
150            
151            BRDPC.checkIAE(
152                "level", level,
153                "error", "warning", "info", "debug"
154            );
155            
156            this.level    = level;
157            this.message  = message;
158        }
159        
160        /**
161         * JSON Object Constructor
162         * @param jo A Json-Object having data about an instance of {@code 'PlayerMessage'}.
163         */
164        public PlayerMessage (JsonObject jo)
165        {
166            this.level    = ReadJSON.getString(jo, "level", false, true);
167            this.message  = ReadJSON.getString(jo, "message", false, true);
168        }
169        
170        
171        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
172        public boolean equals(Object other)
173        {
174            if (other == null)                       return false;
175            if (other.getClass() != this.getClass()) return false;
176        
177            PlayerMessage o = (PlayerMessage) other;
178        
179            return
180                    Objects.equals(this.level, o.level)
181                &&  Objects.equals(this.message, o.message);
182        }
183        
184        /** Generates a Hash-Code for {@code 'this'} instance */
185        public int hashCode()
186        {
187            return
188                    Objects.hashCode(this.level)
189                +   Objects.hashCode(this.message);
190        }
191    }
192    
193    /** Corresponds to kMediaPropertyChange */
194    public static class PlayerProperty
195        extends BaseType
196        implements java.io.Serializable
197    {
198        /** For Object Serialization.  java.io.Serializable */
199        protected static final long serialVersionUID = 1;
200        
201        public boolean[] optionals()
202        { return new boolean[] { false, false, }; }
203        
204        /** <CODE>[No Description Provided by Google]</CODE> */
205        public final String name;
206        
207        /** <CODE>[No Description Provided by Google]</CODE> */
208        public final String value;
209        
210        /**
211         * Constructor
212         *
213         * @param name -
214         * 
215         * @param value -
216         */
217        public PlayerProperty(String name, String value)
218        {
219            // Exception-Check(s) to ensure that if any parameters which are not declared as
220            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
221            
222            if (name == null)  BRDPC.throwNPE("name");
223            if (value == null) BRDPC.throwNPE("value");
224            
225            this.name   = name;
226            this.value  = value;
227        }
228        
229        /**
230         * JSON Object Constructor
231         * @param jo A Json-Object having data about an instance of {@code 'PlayerProperty'}.
232         */
233        public PlayerProperty (JsonObject jo)
234        {
235            this.name   = ReadJSON.getString(jo, "name", false, true);
236            this.value  = ReadJSON.getString(jo, "value", false, true);
237        }
238        
239        
240        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
241        public boolean equals(Object other)
242        {
243            if (other == null)                       return false;
244            if (other.getClass() != this.getClass()) return false;
245        
246            PlayerProperty o = (PlayerProperty) other;
247        
248            return
249                    Objects.equals(this.name, o.name)
250                &&  Objects.equals(this.value, o.value);
251        }
252        
253        /** Generates a Hash-Code for {@code 'this'} instance */
254        public int hashCode()
255        {
256            return
257                    Objects.hashCode(this.name)
258                +   Objects.hashCode(this.value);
259        }
260    }
261    
262    /** Corresponds to kMediaEventTriggered */
263    public static class PlayerEvent
264        extends BaseType
265        implements java.io.Serializable
266    {
267        /** For Object Serialization.  java.io.Serializable */
268        protected static final long serialVersionUID = 1;
269        
270        public boolean[] optionals()
271        { return new boolean[] { false, false, }; }
272        
273        /** <CODE>[No Description Provided by Google]</CODE> */
274        public final Number timestamp;
275        
276        /** <CODE>[No Description Provided by Google]</CODE> */
277        public final String value;
278        
279        /**
280         * Constructor
281         *
282         * @param timestamp -
283         * 
284         * @param value -
285         */
286        public PlayerEvent(Number timestamp, String value)
287        {
288            // Exception-Check(s) to ensure that if any parameters which are not declared as
289            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
290            
291            if (timestamp == null) BRDPC.throwNPE("timestamp");
292            if (value == null)     BRDPC.throwNPE("value");
293            
294            this.timestamp  = timestamp;
295            this.value      = value;
296        }
297        
298        /**
299         * JSON Object Constructor
300         * @param jo A Json-Object having data about an instance of {@code 'PlayerEvent'}.
301         */
302        public PlayerEvent (JsonObject jo)
303        {
304            this.timestamp  = ReadNumberJSON.get(jo, "timestamp", false, true);
305            this.value      = ReadJSON.getString(jo, "value", false, true);
306        }
307        
308        
309        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
310        public boolean equals(Object other)
311        {
312            if (other == null)                       return false;
313            if (other.getClass() != this.getClass()) return false;
314        
315            PlayerEvent o = (PlayerEvent) other;
316        
317            return
318                    Objects.equals(this.timestamp, o.timestamp)
319                &&  Objects.equals(this.value, o.value);
320        }
321        
322        /** Generates a Hash-Code for {@code 'this'} instance */
323        public int hashCode()
324        {
325            return
326                    Objects.hashCode(this.timestamp)
327                +   Objects.hashCode(this.value);
328        }
329    }
330    
331    /** Corresponds to kMediaError */
332    public static class PlayerError
333        extends BaseType
334        implements java.io.Serializable
335    {
336        /** For Object Serialization.  java.io.Serializable */
337        protected static final long serialVersionUID = 1;
338        
339        public boolean[] optionals()
340        { return new boolean[] { false, false, }; }
341        
342        /** <CODE>[No Description Provided by Google]</CODE> */
343        public final String type;
344        
345        /**
346         * When this switches to using media::Status instead of PipelineStatus
347         * we can remove "errorCode" and replace it with the fields from
348         * a Status instance. This also seems like a duplicate of the error
349         * level enum - there is a todo bug to have that level removed and
350         * use this instead. (crbug.com/1068454)
351         */
352        public final String errorCode;
353        
354        /**
355         * Constructor
356         *
357         * @param type -
358         * <BR />Acceptable Values: ["pipeline_error", "media_error"]
359         * 
360         * @param errorCode 
361         * When this switches to using media::Status instead of PipelineStatus
362         * we can remove "errorCode" and replace it with the fields from
363         * a Status instance. This also seems like a duplicate of the error
364         * level enum - there is a todo bug to have that level removed and
365         * use this instead. (crbug.com/1068454)
366         */
367        public PlayerError(String type, String errorCode)
368        {
369            // Exception-Check(s) to ensure that if any parameters which are not declared as
370            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
371            
372            if (type == null)      BRDPC.throwNPE("type");
373            if (errorCode == null) BRDPC.throwNPE("errorCode");
374            
375            // Exception-Check(s) to ensure that if any parameters which must adhere to a
376            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
377            
378            BRDPC.checkIAE(
379                "type", type,
380                "pipeline_error", "media_error"
381            );
382            
383            this.type       = type;
384            this.errorCode  = errorCode;
385        }
386        
387        /**
388         * JSON Object Constructor
389         * @param jo A Json-Object having data about an instance of {@code 'PlayerError'}.
390         */
391        public PlayerError (JsonObject jo)
392        {
393            this.type       = ReadJSON.getString(jo, "type", false, true);
394            this.errorCode  = ReadJSON.getString(jo, "errorCode", false, true);
395        }
396        
397        
398        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
399        public boolean equals(Object other)
400        {
401            if (other == null)                       return false;
402            if (other.getClass() != this.getClass()) return false;
403        
404            PlayerError o = (PlayerError) other;
405        
406            return
407                    Objects.equals(this.type, o.type)
408                &&  Objects.equals(this.errorCode, o.errorCode);
409        }
410        
411        /** Generates a Hash-Code for {@code 'this'} instance */
412        public int hashCode()
413        {
414            return
415                    Objects.hashCode(this.type)
416                +   Objects.hashCode(this.errorCode);
417        }
418    }
419    
420    /**
421     * This can be called multiple times, and can be used to set / override /
422     * remove player properties. A null propValue indicates removal.
423     */
424    public static class playerPropertiesChanged
425        extends BrowserEvent
426        implements java.io.Serializable
427    {
428        /** For Object Serialization.  java.io.Serializable */
429        protected static final long serialVersionUID = 1;
430        
431        public boolean[] optionals()
432        { return new boolean[] { false, false, }; }
433        
434        /** <CODE>[No Description Provided by Google]</CODE> */
435        public final String playerId;
436        
437        /** <CODE>[No Description Provided by Google]</CODE> */
438        public final Media.PlayerProperty[] properties;
439        
440        /**
441         * Constructor
442         *
443         * @param playerId -
444         * 
445         * @param properties -
446         */
447        public playerPropertiesChanged(String playerId, Media.PlayerProperty[] properties)
448        {
449            super("Media", "playerPropertiesChanged", 2);
450            
451            // Exception-Check(s) to ensure that if any parameters which are not declared as
452            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
453            
454            if (playerId == null)   BRDPC.throwNPE("playerId");
455            if (properties == null) BRDPC.throwNPE("properties");
456            
457            this.playerId    = playerId;
458            this.properties  = properties;
459        }
460        
461        /**
462         * JSON Object Constructor
463         * @param jo A Json-Object having data about an instance of {@code 'playerPropertiesChanged'}.
464         */
465        public playerPropertiesChanged (JsonObject jo)
466        {
467            super("Media", "playerPropertiesChanged", 2);
468        
469            this.playerId    = ReadJSON.getString(jo, "playerId", false, true);
470            this.properties = (jo.getJsonArray("properties") == null)
471                ? null
472                : RJArrDimN.objArr(jo.getJsonArray("properties"), null, 0, Media.PlayerProperty[].class);
473        
474        }
475        
476        
477        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
478        public boolean equals(Object other)
479        {
480            if (other == null)                       return false;
481            if (other.getClass() != this.getClass()) return false;
482        
483            playerPropertiesChanged o = (playerPropertiesChanged) other;
484        
485            return
486                    Objects.equals(this.playerId, o.playerId)
487                &&  Arrays.deepEquals(this.properties, o.properties);
488        }
489        
490        /** Generates a Hash-Code for {@code 'this'} instance */
491        public int hashCode()
492        {
493            return
494                    Objects.hashCode(this.playerId)
495                +   Arrays.deepHashCode(this.properties);
496        }
497    }
498    
499    /**
500     * Send events as a list, allowing them to be batched on the browser for less
501     * congestion. If batched, events must ALWAYS be in chronological order.
502     */
503    public static class playerEventsAdded
504        extends BrowserEvent
505        implements java.io.Serializable
506    {
507        /** For Object Serialization.  java.io.Serializable */
508        protected static final long serialVersionUID = 1;
509        
510        public boolean[] optionals()
511        { return new boolean[] { false, false, }; }
512        
513        /** <CODE>[No Description Provided by Google]</CODE> */
514        public final String playerId;
515        
516        /** <CODE>[No Description Provided by Google]</CODE> */
517        public final Media.PlayerEvent[] events;
518        
519        /**
520         * Constructor
521         *
522         * @param playerId -
523         * 
524         * @param events -
525         */
526        public playerEventsAdded(String playerId, Media.PlayerEvent[] events)
527        {
528            super("Media", "playerEventsAdded", 2);
529            
530            // Exception-Check(s) to ensure that if any parameters which are not declared as
531            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
532            
533            if (playerId == null) BRDPC.throwNPE("playerId");
534            if (events == null)   BRDPC.throwNPE("events");
535            
536            this.playerId  = playerId;
537            this.events    = events;
538        }
539        
540        /**
541         * JSON Object Constructor
542         * @param jo A Json-Object having data about an instance of {@code 'playerEventsAdded'}.
543         */
544        public playerEventsAdded (JsonObject jo)
545        {
546            super("Media", "playerEventsAdded", 2);
547        
548            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
549            this.events = (jo.getJsonArray("events") == null)
550                ? null
551                : RJArrDimN.objArr(jo.getJsonArray("events"), null, 0, Media.PlayerEvent[].class);
552        
553        }
554        
555        
556        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
557        public boolean equals(Object other)
558        {
559            if (other == null)                       return false;
560            if (other.getClass() != this.getClass()) return false;
561        
562            playerEventsAdded o = (playerEventsAdded) other;
563        
564            return
565                    Objects.equals(this.playerId, o.playerId)
566                &&  Arrays.deepEquals(this.events, o.events);
567        }
568        
569        /** Generates a Hash-Code for {@code 'this'} instance */
570        public int hashCode()
571        {
572            return
573                    Objects.hashCode(this.playerId)
574                +   Arrays.deepHashCode(this.events);
575        }
576    }
577    
578    /** Send a list of any messages that need to be delivered. */
579    public static class playerMessagesLogged
580        extends BrowserEvent
581        implements java.io.Serializable
582    {
583        /** For Object Serialization.  java.io.Serializable */
584        protected static final long serialVersionUID = 1;
585        
586        public boolean[] optionals()
587        { return new boolean[] { false, false, }; }
588        
589        /** <CODE>[No Description Provided by Google]</CODE> */
590        public final String playerId;
591        
592        /** <CODE>[No Description Provided by Google]</CODE> */
593        public final Media.PlayerMessage[] messages;
594        
595        /**
596         * Constructor
597         *
598         * @param playerId -
599         * 
600         * @param messages -
601         */
602        public playerMessagesLogged(String playerId, Media.PlayerMessage[] messages)
603        {
604            super("Media", "playerMessagesLogged", 2);
605            
606            // Exception-Check(s) to ensure that if any parameters which are not declared as
607            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
608            
609            if (playerId == null) BRDPC.throwNPE("playerId");
610            if (messages == null) BRDPC.throwNPE("messages");
611            
612            this.playerId  = playerId;
613            this.messages  = messages;
614        }
615        
616        /**
617         * JSON Object Constructor
618         * @param jo A Json-Object having data about an instance of {@code 'playerMessagesLogged'}.
619         */
620        public playerMessagesLogged (JsonObject jo)
621        {
622            super("Media", "playerMessagesLogged", 2);
623        
624            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
625            this.messages = (jo.getJsonArray("messages") == null)
626                ? null
627                : RJArrDimN.objArr(jo.getJsonArray("messages"), null, 0, Media.PlayerMessage[].class);
628        
629        }
630        
631        
632        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
633        public boolean equals(Object other)
634        {
635            if (other == null)                       return false;
636            if (other.getClass() != this.getClass()) return false;
637        
638            playerMessagesLogged o = (playerMessagesLogged) other;
639        
640            return
641                    Objects.equals(this.playerId, o.playerId)
642                &&  Arrays.deepEquals(this.messages, o.messages);
643        }
644        
645        /** Generates a Hash-Code for {@code 'this'} instance */
646        public int hashCode()
647        {
648            return
649                    Objects.hashCode(this.playerId)
650                +   Arrays.deepHashCode(this.messages);
651        }
652    }
653    
654    /** Send a list of any errors that need to be delivered. */
655    public static class playerErrorsRaised
656        extends BrowserEvent
657        implements java.io.Serializable
658    {
659        /** For Object Serialization.  java.io.Serializable */
660        protected static final long serialVersionUID = 1;
661        
662        public boolean[] optionals()
663        { return new boolean[] { false, false, }; }
664        
665        /** <CODE>[No Description Provided by Google]</CODE> */
666        public final String playerId;
667        
668        /** <CODE>[No Description Provided by Google]</CODE> */
669        public final Media.PlayerError[] errors;
670        
671        /**
672         * Constructor
673         *
674         * @param playerId -
675         * 
676         * @param errors -
677         */
678        public playerErrorsRaised(String playerId, Media.PlayerError[] errors)
679        {
680            super("Media", "playerErrorsRaised", 2);
681            
682            // Exception-Check(s) to ensure that if any parameters which are not declared as
683            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
684            
685            if (playerId == null) BRDPC.throwNPE("playerId");
686            if (errors == null)   BRDPC.throwNPE("errors");
687            
688            this.playerId  = playerId;
689            this.errors    = errors;
690        }
691        
692        /**
693         * JSON Object Constructor
694         * @param jo A Json-Object having data about an instance of {@code 'playerErrorsRaised'}.
695         */
696        public playerErrorsRaised (JsonObject jo)
697        {
698            super("Media", "playerErrorsRaised", 2);
699        
700            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
701            this.errors = (jo.getJsonArray("errors") == null)
702                ? null
703                : RJArrDimN.objArr(jo.getJsonArray("errors"), null, 0, Media.PlayerError[].class);
704        
705        }
706        
707        
708        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
709        public boolean equals(Object other)
710        {
711            if (other == null)                       return false;
712            if (other.getClass() != this.getClass()) return false;
713        
714            playerErrorsRaised o = (playerErrorsRaised) other;
715        
716            return
717                    Objects.equals(this.playerId, o.playerId)
718                &&  Arrays.deepEquals(this.errors, o.errors);
719        }
720        
721        /** Generates a Hash-Code for {@code 'this'} instance */
722        public int hashCode()
723        {
724            return
725                    Objects.hashCode(this.playerId)
726                +   Arrays.deepHashCode(this.errors);
727        }
728    }
729    
730    /**
731     * Called whenever a player is created, or when a new agent joins and receives
732     * a list of active players. If an agent is restored, it will receive the full
733     * list of player ids and all events again.
734     */
735    public static class playersCreated
736        extends BrowserEvent
737        implements java.io.Serializable
738    {
739        /** For Object Serialization.  java.io.Serializable */
740        protected static final long serialVersionUID = 1;
741        
742        public boolean[] optionals()
743        { return new boolean[] { false, }; }
744        
745        /** <CODE>[No Description Provided by Google]</CODE> */
746        public final String[] players;
747        
748        /**
749         * Constructor
750         *
751         * @param players -
752         */
753        public playersCreated(String[] players)
754        {
755            super("Media", "playersCreated", 1);
756            
757            // Exception-Check(s) to ensure that if any parameters which are not declared as
758            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
759            
760            if (players == null) BRDPC.throwNPE("players");
761            
762            this.players  = players;
763        }
764        
765        /**
766         * JSON Object Constructor
767         * @param jo A Json-Object having data about an instance of {@code 'playersCreated'}.
768         */
769        public playersCreated (JsonObject jo)
770        {
771            super("Media", "playersCreated", 1);
772        
773            this.players = (jo.getJsonArray("players") == null)
774                ? null
775                : RJArrIntoStream.strArr(jo.getJsonArray("players"), null, 0).toArray(String[]::new);
776        
777        }
778        
779        
780        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
781        public boolean equals(Object other)
782        {
783            if (other == null)                       return false;
784            if (other.getClass() != this.getClass()) return false;
785        
786            playersCreated o = (playersCreated) other;
787        
788            return
789                    Arrays.deepEquals(this.players, o.players);
790        }
791        
792        /** Generates a Hash-Code for {@code 'this'} instance */
793        public int hashCode()
794        {
795            return
796                    Arrays.deepHashCode(this.players);
797        }
798    }
799    
800    
801    // Counter for keeping the WebSocket Request ID's distinct.
802    private static int counter = 1;
803    
804    /**
805     * Enables the Media domain
806     * 
807     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
808     * {@link Ret0}&gt;</CODE>
809     *
810     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
811     * browser receives the invocation-request.
812     *
813     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
814     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
815     * {@code >} to ensure the Browser Function has run to completion.
816     */
817    public static Script<String, JsonObject, Ret0> enable()
818    {
819        final int          webSocketID = 45000000 + counter++;
820        final boolean[]    optionals   = new boolean[0];
821        
822        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
823        String requestJSON = WriteJSON.get(
824            parameterTypes.get("enable"),
825            parameterNames.get("enable"),
826            optionals, webSocketID,
827            "Media.enable"
828        );
829        
830        // This Remote Command does not have a Return-Value.
831        return new Script<>
832            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
833    }
834    
835    /**
836     * Disables the Media domain.
837     * 
838     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
839     * {@link Ret0}&gt;</CODE>
840     *
841     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
842     * browser receives the invocation-request.
843     *
844     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
845     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
846     * {@code >} to ensure the Browser Function has run to completion.
847     */
848    public static Script<String, JsonObject, Ret0> disable()
849    {
850        final int          webSocketID = 45001000 + counter++;
851        final boolean[]    optionals   = new boolean[0];
852        
853        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
854        String requestJSON = WriteJSON.get(
855            parameterTypes.get("disable"),
856            parameterNames.get("disable"),
857            optionals, webSocketID,
858            "Media.disable"
859        );
860        
861        // This Remote Command does not have a Return-Value.
862        return new Script<>
863            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
864    }
865    
866}