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)   THROWS.throwNPE("level");
146            if (message == null) THROWS.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            THROWS.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 (this == other)                       return true;
175            if (other == null)                       return false;
176            if (other.getClass() != this.getClass()) return false;
177        
178            PlayerMessage o = (PlayerMessage) other;
179        
180            return
181                    Objects.equals(this.level, o.level)
182                &&  Objects.equals(this.message, o.message);
183        }
184        
185        /** Generates a Hash-Code for {@code 'this'} instance */
186        public int hashCode()
187        {
188            return
189                    Objects.hashCode(this.level)
190                +   Objects.hashCode(this.message);
191        }
192    }
193    
194    /** Corresponds to kMediaPropertyChange */
195    public static class PlayerProperty
196        extends BaseType
197        implements java.io.Serializable
198    {
199        /** For Object Serialization.  java.io.Serializable */
200        protected static final long serialVersionUID = 1;
201        
202        public boolean[] optionals()
203        { return new boolean[] { false, false, }; }
204        
205        /** <CODE>[No Description Provided by Google]</CODE> */
206        public final String name;
207        
208        /** <CODE>[No Description Provided by Google]</CODE> */
209        public final String value;
210        
211        /**
212         * Constructor
213         *
214         * @param name -
215         * 
216         * @param value -
217         */
218        public PlayerProperty(String name, String value)
219        {
220            // Exception-Check(s) to ensure that if any parameters which are not declared as
221            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
222            
223            if (name == null)  THROWS.throwNPE("name");
224            if (value == null) THROWS.throwNPE("value");
225            
226            this.name   = name;
227            this.value  = value;
228        }
229        
230        /**
231         * JSON Object Constructor
232         * @param jo A Json-Object having data about an instance of {@code 'PlayerProperty'}.
233         */
234        public PlayerProperty (JsonObject jo)
235        {
236            this.name   = ReadJSON.getString(jo, "name", false, true);
237            this.value  = ReadJSON.getString(jo, "value", false, true);
238        }
239        
240        
241        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
242        public boolean equals(Object other)
243        {
244            if (this == other)                       return true;
245            if (other == null)                       return false;
246            if (other.getClass() != this.getClass()) return false;
247        
248            PlayerProperty o = (PlayerProperty) other;
249        
250            return
251                    Objects.equals(this.name, o.name)
252                &&  Objects.equals(this.value, o.value);
253        }
254        
255        /** Generates a Hash-Code for {@code 'this'} instance */
256        public int hashCode()
257        {
258            return
259                    Objects.hashCode(this.name)
260                +   Objects.hashCode(this.value);
261        }
262    }
263    
264    /** Corresponds to kMediaEventTriggered */
265    public static class PlayerEvent
266        extends BaseType
267        implements java.io.Serializable
268    {
269        /** For Object Serialization.  java.io.Serializable */
270        protected static final long serialVersionUID = 1;
271        
272        public boolean[] optionals()
273        { return new boolean[] { false, false, }; }
274        
275        /** <CODE>[No Description Provided by Google]</CODE> */
276        public final Number timestamp;
277        
278        /** <CODE>[No Description Provided by Google]</CODE> */
279        public final String value;
280        
281        /**
282         * Constructor
283         *
284         * @param timestamp -
285         * 
286         * @param value -
287         */
288        public PlayerEvent(Number timestamp, String value)
289        {
290            // Exception-Check(s) to ensure that if any parameters which are not declared as
291            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
292            
293            if (timestamp == null) THROWS.throwNPE("timestamp");
294            if (value == null)     THROWS.throwNPE("value");
295            
296            this.timestamp  = timestamp;
297            this.value      = value;
298        }
299        
300        /**
301         * JSON Object Constructor
302         * @param jo A Json-Object having data about an instance of {@code 'PlayerEvent'}.
303         */
304        public PlayerEvent (JsonObject jo)
305        {
306            this.timestamp  = ReadNumberJSON.get(jo, "timestamp", false, true);
307            this.value      = ReadJSON.getString(jo, "value", false, true);
308        }
309        
310        
311        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
312        public boolean equals(Object other)
313        {
314            if (this == other)                       return true;
315            if (other == null)                       return false;
316            if (other.getClass() != this.getClass()) return false;
317        
318            PlayerEvent o = (PlayerEvent) other;
319        
320            return
321                    Objects.equals(this.timestamp, o.timestamp)
322                &&  Objects.equals(this.value, o.value);
323        }
324        
325        /** Generates a Hash-Code for {@code 'this'} instance */
326        public int hashCode()
327        {
328            return
329                    Objects.hashCode(this.timestamp)
330                +   Objects.hashCode(this.value);
331        }
332    }
333    
334    /** Corresponds to kMediaError */
335    public static class PlayerError
336        extends BaseType
337        implements java.io.Serializable
338    {
339        /** For Object Serialization.  java.io.Serializable */
340        protected static final long serialVersionUID = 1;
341        
342        public boolean[] optionals()
343        { return new boolean[] { false, false, }; }
344        
345        /** <CODE>[No Description Provided by Google]</CODE> */
346        public final String type;
347        
348        /**
349         * When this switches to using media::Status instead of PipelineStatus
350         * we can remove "errorCode" and replace it with the fields from
351         * a Status instance. This also seems like a duplicate of the error
352         * level enum - there is a todo bug to have that level removed and
353         * use this instead. (crbug.com/1068454)
354         */
355        public final String errorCode;
356        
357        /**
358         * Constructor
359         *
360         * @param type -
361         * <BR />Acceptable Values: ["pipeline_error", "media_error"]
362         * 
363         * @param errorCode 
364         * When this switches to using media::Status instead of PipelineStatus
365         * we can remove "errorCode" and replace it with the fields from
366         * a Status instance. This also seems like a duplicate of the error
367         * level enum - there is a todo bug to have that level removed and
368         * use this instead. (crbug.com/1068454)
369         */
370        public PlayerError(String type, String errorCode)
371        {
372            // Exception-Check(s) to ensure that if any parameters which are not declared as
373            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
374            
375            if (type == null)      THROWS.throwNPE("type");
376            if (errorCode == null) THROWS.throwNPE("errorCode");
377            
378            // Exception-Check(s) to ensure that if any parameters which must adhere to a
379            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
380            
381            THROWS.checkIAE(
382                "type", type,
383                "pipeline_error", "media_error"
384            );
385            
386            this.type       = type;
387            this.errorCode  = errorCode;
388        }
389        
390        /**
391         * JSON Object Constructor
392         * @param jo A Json-Object having data about an instance of {@code 'PlayerError'}.
393         */
394        public PlayerError (JsonObject jo)
395        {
396            this.type       = ReadJSON.getString(jo, "type", false, true);
397            this.errorCode  = ReadJSON.getString(jo, "errorCode", false, true);
398        }
399        
400        
401        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
402        public boolean equals(Object other)
403        {
404            if (this == other)                       return true;
405            if (other == null)                       return false;
406            if (other.getClass() != this.getClass()) return false;
407        
408            PlayerError o = (PlayerError) other;
409        
410            return
411                    Objects.equals(this.type, o.type)
412                &&  Objects.equals(this.errorCode, o.errorCode);
413        }
414        
415        /** Generates a Hash-Code for {@code 'this'} instance */
416        public int hashCode()
417        {
418            return
419                    Objects.hashCode(this.type)
420                +   Objects.hashCode(this.errorCode);
421        }
422    }
423    
424    /**
425     * This can be called multiple times, and can be used to set / override /
426     * remove player properties. A null propValue indicates removal.
427     */
428    public static class playerPropertiesChanged
429        extends BrowserEvent
430        implements java.io.Serializable
431    {
432        /** For Object Serialization.  java.io.Serializable */
433        protected static final long serialVersionUID = 1;
434        
435        public boolean[] optionals()
436        { return new boolean[] { false, false, }; }
437        
438        /** <CODE>[No Description Provided by Google]</CODE> */
439        public final String playerId;
440        
441        /** <CODE>[No Description Provided by Google]</CODE> */
442        public final Media.PlayerProperty[] properties;
443        
444        /**
445         * Constructor
446         *
447         * @param playerId -
448         * 
449         * @param properties -
450         */
451        public playerPropertiesChanged(String playerId, Media.PlayerProperty[] properties)
452        {
453            super("Media", "playerPropertiesChanged", 2);
454            
455            // Exception-Check(s) to ensure that if any parameters which are not declared as
456            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
457            
458            if (playerId == null)   THROWS.throwNPE("playerId");
459            if (properties == null) THROWS.throwNPE("properties");
460            
461            this.playerId    = playerId;
462            this.properties  = properties;
463        }
464        
465        /**
466         * JSON Object Constructor
467         * @param jo A Json-Object having data about an instance of {@code 'playerPropertiesChanged'}.
468         */
469        public playerPropertiesChanged (JsonObject jo)
470        {
471            super("Media", "playerPropertiesChanged", 2);
472        
473            this.playerId    = ReadJSON.getString(jo, "playerId", false, true);
474            this.properties = (jo.getJsonArray("properties") == null)
475                ? null
476                : RJArrIntoStream.objArr(jo.getJsonArray("properties"), null, 0, Media.PlayerProperty.class).toArray(Media.PlayerProperty[]::new);
477        
478        }
479        
480        
481        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
482        public boolean equals(Object other)
483        {
484            if (this == other)                       return true;
485            if (other == null)                       return false;
486            if (other.getClass() != this.getClass()) return false;
487        
488            playerPropertiesChanged o = (playerPropertiesChanged) other;
489        
490            return
491                    Objects.equals(this.playerId, o.playerId)
492                &&  Arrays.deepEquals(this.properties, o.properties);
493        }
494        
495        /** Generates a Hash-Code for {@code 'this'} instance */
496        public int hashCode()
497        {
498            return
499                    Objects.hashCode(this.playerId)
500                +   Arrays.deepHashCode(this.properties);
501        }
502    }
503    
504    /**
505     * Send events as a list, allowing them to be batched on the browser for less
506     * congestion. If batched, events must ALWAYS be in chronological order.
507     */
508    public static class playerEventsAdded
509        extends BrowserEvent
510        implements java.io.Serializable
511    {
512        /** For Object Serialization.  java.io.Serializable */
513        protected static final long serialVersionUID = 1;
514        
515        public boolean[] optionals()
516        { return new boolean[] { false, false, }; }
517        
518        /** <CODE>[No Description Provided by Google]</CODE> */
519        public final String playerId;
520        
521        /** <CODE>[No Description Provided by Google]</CODE> */
522        public final Media.PlayerEvent[] events;
523        
524        /**
525         * Constructor
526         *
527         * @param playerId -
528         * 
529         * @param events -
530         */
531        public playerEventsAdded(String playerId, Media.PlayerEvent[] events)
532        {
533            super("Media", "playerEventsAdded", 2);
534            
535            // Exception-Check(s) to ensure that if any parameters which are not declared as
536            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
537            
538            if (playerId == null) THROWS.throwNPE("playerId");
539            if (events == null)   THROWS.throwNPE("events");
540            
541            this.playerId  = playerId;
542            this.events    = events;
543        }
544        
545        /**
546         * JSON Object Constructor
547         * @param jo A Json-Object having data about an instance of {@code 'playerEventsAdded'}.
548         */
549        public playerEventsAdded (JsonObject jo)
550        {
551            super("Media", "playerEventsAdded", 2);
552        
553            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
554            this.events = (jo.getJsonArray("events") == null)
555                ? null
556                : RJArrIntoStream.objArr(jo.getJsonArray("events"), null, 0, Media.PlayerEvent.class).toArray(Media.PlayerEvent[]::new);
557        
558        }
559        
560        
561        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
562        public boolean equals(Object other)
563        {
564            if (this == other)                       return true;
565            if (other == null)                       return false;
566            if (other.getClass() != this.getClass()) return false;
567        
568            playerEventsAdded o = (playerEventsAdded) other;
569        
570            return
571                    Objects.equals(this.playerId, o.playerId)
572                &&  Arrays.deepEquals(this.events, o.events);
573        }
574        
575        /** Generates a Hash-Code for {@code 'this'} instance */
576        public int hashCode()
577        {
578            return
579                    Objects.hashCode(this.playerId)
580                +   Arrays.deepHashCode(this.events);
581        }
582    }
583    
584    /** Send a list of any messages that need to be delivered. */
585    public static class playerMessagesLogged
586        extends BrowserEvent
587        implements java.io.Serializable
588    {
589        /** For Object Serialization.  java.io.Serializable */
590        protected static final long serialVersionUID = 1;
591        
592        public boolean[] optionals()
593        { return new boolean[] { false, false, }; }
594        
595        /** <CODE>[No Description Provided by Google]</CODE> */
596        public final String playerId;
597        
598        /** <CODE>[No Description Provided by Google]</CODE> */
599        public final Media.PlayerMessage[] messages;
600        
601        /**
602         * Constructor
603         *
604         * @param playerId -
605         * 
606         * @param messages -
607         */
608        public playerMessagesLogged(String playerId, Media.PlayerMessage[] messages)
609        {
610            super("Media", "playerMessagesLogged", 2);
611            
612            // Exception-Check(s) to ensure that if any parameters which are not declared as
613            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
614            
615            if (playerId == null) THROWS.throwNPE("playerId");
616            if (messages == null) THROWS.throwNPE("messages");
617            
618            this.playerId  = playerId;
619            this.messages  = messages;
620        }
621        
622        /**
623         * JSON Object Constructor
624         * @param jo A Json-Object having data about an instance of {@code 'playerMessagesLogged'}.
625         */
626        public playerMessagesLogged (JsonObject jo)
627        {
628            super("Media", "playerMessagesLogged", 2);
629        
630            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
631            this.messages = (jo.getJsonArray("messages") == null)
632                ? null
633                : RJArrIntoStream.objArr(jo.getJsonArray("messages"), null, 0, Media.PlayerMessage.class).toArray(Media.PlayerMessage[]::new);
634        
635        }
636        
637        
638        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
639        public boolean equals(Object other)
640        {
641            if (this == other)                       return true;
642            if (other == null)                       return false;
643            if (other.getClass() != this.getClass()) return false;
644        
645            playerMessagesLogged o = (playerMessagesLogged) other;
646        
647            return
648                    Objects.equals(this.playerId, o.playerId)
649                &&  Arrays.deepEquals(this.messages, o.messages);
650        }
651        
652        /** Generates a Hash-Code for {@code 'this'} instance */
653        public int hashCode()
654        {
655            return
656                    Objects.hashCode(this.playerId)
657                +   Arrays.deepHashCode(this.messages);
658        }
659    }
660    
661    /** Send a list of any errors that need to be delivered. */
662    public static class playerErrorsRaised
663        extends BrowserEvent
664        implements java.io.Serializable
665    {
666        /** For Object Serialization.  java.io.Serializable */
667        protected static final long serialVersionUID = 1;
668        
669        public boolean[] optionals()
670        { return new boolean[] { false, false, }; }
671        
672        /** <CODE>[No Description Provided by Google]</CODE> */
673        public final String playerId;
674        
675        /** <CODE>[No Description Provided by Google]</CODE> */
676        public final Media.PlayerError[] errors;
677        
678        /**
679         * Constructor
680         *
681         * @param playerId -
682         * 
683         * @param errors -
684         */
685        public playerErrorsRaised(String playerId, Media.PlayerError[] errors)
686        {
687            super("Media", "playerErrorsRaised", 2);
688            
689            // Exception-Check(s) to ensure that if any parameters which are not declared as
690            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
691            
692            if (playerId == null) THROWS.throwNPE("playerId");
693            if (errors == null)   THROWS.throwNPE("errors");
694            
695            this.playerId  = playerId;
696            this.errors    = errors;
697        }
698        
699        /**
700         * JSON Object Constructor
701         * @param jo A Json-Object having data about an instance of {@code 'playerErrorsRaised'}.
702         */
703        public playerErrorsRaised (JsonObject jo)
704        {
705            super("Media", "playerErrorsRaised", 2);
706        
707            this.playerId  = ReadJSON.getString(jo, "playerId", false, true);
708            this.errors = (jo.getJsonArray("errors") == null)
709                ? null
710                : RJArrIntoStream.objArr(jo.getJsonArray("errors"), null, 0, Media.PlayerError.class).toArray(Media.PlayerError[]::new);
711        
712        }
713        
714        
715        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
716        public boolean equals(Object other)
717        {
718            if (this == other)                       return true;
719            if (other == null)                       return false;
720            if (other.getClass() != this.getClass()) return false;
721        
722            playerErrorsRaised o = (playerErrorsRaised) other;
723        
724            return
725                    Objects.equals(this.playerId, o.playerId)
726                &&  Arrays.deepEquals(this.errors, o.errors);
727        }
728        
729        /** Generates a Hash-Code for {@code 'this'} instance */
730        public int hashCode()
731        {
732            return
733                    Objects.hashCode(this.playerId)
734                +   Arrays.deepHashCode(this.errors);
735        }
736    }
737    
738    /**
739     * Called whenever a player is created, or when a new agent joins and receives
740     * a list of active players. If an agent is restored, it will receive the full
741     * list of player ids and all events again.
742     */
743    public static class playersCreated
744        extends BrowserEvent
745        implements java.io.Serializable
746    {
747        /** For Object Serialization.  java.io.Serializable */
748        protected static final long serialVersionUID = 1;
749        
750        public boolean[] optionals()
751        { return new boolean[] { false, }; }
752        
753        /** <CODE>[No Description Provided by Google]</CODE> */
754        public final String[] players;
755        
756        /**
757         * Constructor
758         *
759         * @param players -
760         */
761        public playersCreated(String[] players)
762        {
763            super("Media", "playersCreated", 1);
764            
765            // Exception-Check(s) to ensure that if any parameters which are not declared as
766            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
767            
768            if (players == null) THROWS.throwNPE("players");
769            
770            this.players  = players;
771        }
772        
773        /**
774         * JSON Object Constructor
775         * @param jo A Json-Object having data about an instance of {@code 'playersCreated'}.
776         */
777        public playersCreated (JsonObject jo)
778        {
779            super("Media", "playersCreated", 1);
780        
781            this.players = (jo.getJsonArray("players") == null)
782                ? null
783                : RJArrIntoStream.strArr(jo.getJsonArray("players"), null, 0).toArray(String[]::new);
784        
785        }
786        
787        
788        /** Checks whether {@code 'this'} equals an input Java-{@code Object} */
789        public boolean equals(Object other)
790        {
791            if (this == other)                       return true;
792            if (other == null)                       return false;
793            if (other.getClass() != this.getClass()) return false;
794        
795            playersCreated o = (playersCreated) other;
796        
797            return
798                    Arrays.deepEquals(this.players, o.players);
799        }
800        
801        /** Generates a Hash-Code for {@code 'this'} instance */
802        public int hashCode()
803        {
804            return
805                    Arrays.deepHashCode(this.players);
806        }
807    }
808    
809    
810    // Counter for keeping the WebSocket Request ID's distinct.
811    private static int counter = 1;
812    
813    /**
814     * Enables the Media domain
815     * 
816     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
817     * {@link Ret0}&gt;</CODE>
818     *
819     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
820     * browser receives the invocation-request.
821     *
822     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
823     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
824     * {@code >} to ensure the Browser Function has run to completion.
825     */
826    public static Script<String, JsonObject, Ret0> enable()
827    {
828        final int          webSocketID = 45000000 + counter++;
829        final boolean[]    optionals   = new boolean[0];
830        
831        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
832        String requestJSON = WriteJSON.get(
833            parameterTypes.get("enable"),
834            parameterNames.get("enable"),
835            optionals, webSocketID,
836            "Media.enable"
837        );
838        
839        // This Remote Command does not have a Return-Value.
840        return new Script<>
841            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
842    }
843    
844    /**
845     * Disables the Media domain.
846     * 
847     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
848     * {@link Ret0}&gt;</CODE>
849     *
850     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
851     * browser receives the invocation-request.
852     *
853     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
854     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
855     * {@code >} to ensure the Browser Function has run to completion.
856     */
857    public static Script<String, JsonObject, Ret0> disable()
858    {
859        final int          webSocketID = 45001000 + counter++;
860        final boolean[]    optionals   = new boolean[0];
861        
862        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
863        String requestJSON = WriteJSON.get(
864            parameterTypes.get("disable"),
865            parameterNames.get("disable"),
866            optionals, webSocketID,
867            "Media.disable"
868        );
869        
870        // This Remote Command does not have a Return-Value.
871        return new Script<>
872            (webSocketID, requestJSON, VOID_RETURN.NoReturnValues);
873    }
874    
875}