16

When I try to call getChildren() on the mediapipeline which has my custom module endpoint running in it I'm getting this exception:

org.kurento.client.internal.server.ProtocolException: Exception creating Java Class for mycustomfilter.MyCustomFilter

This is the code which triggers it:

List<MediaObject> mediaObjects = pipelines.get(i).getChildren();

Do I have to cast the List<MediaObject> to some other data type?

n0p
  • 713
  • 10
  • 23
Sagar Pilkhwal
  • 3,998
  • 2
  • 25
  • 77

2 Answers2

2

When you create a custom media element for KMS, you can also create the client API for Java and JavaScript (see doc here). In your case, you need to create the Java client for your filter, as follows:

cmake .. -DGENERATE_JAVA_CLIENT_PROJECT=TRUE

The resulting Java classes (package mycustomfilter.MyCustomFilter in your example) should be in the classpath of the project which calls to getChildren() (internally it calls to Class.forName, see code here).

Boni García
  • 4,618
  • 5
  • 28
  • 44
  • thats correct, but what if I want to access such a KMS with custom module of which I don't have the `jar`. As these custom modules may inherit `FilterImpl` or `HubImpl` isn't it possible to cast the custom module directly into parent classes ? – Sagar Pilkhwal Feb 23 '17 at 05:54
  • 1
    You can still use that module even if you don't have the JAR. But it that case you will need to speak directly the Kurento protocol (see info [here](http://doc-kurento.readthedocs.io/en/stable/mastering/kurento_protocol.html)) with KMS (i.e. JSON-RPC messages). But for the best of my knowledge, if you don't have the JAR, the initial problem (exception when calling to `getChildren()`) cannot be solved. – Boni García Feb 23 '17 at 08:26
0

Could you try this?

List<MediaObject> mediaObjects = new ArrayList<MediaObject>(Arrays.asList(pipelines.get(i).getChildren()));
Rendy Eko Prastiyo
  • 1,068
  • 7
  • 16