Creating App Grabber for Samsung TV

  • We are trying to implement a screen capture functionality on a Samsung TV with Tizen OS and send the captured image to Hyperion using WebSocket. Despite multiple attempts, we are encountering issues with the JSON data validation on the Hyperion server. Here are the steps and problems we've faced:

    1. Capture Screen on Tizen TV:
      • We are capturing a specific area of the screen using a <canvas> element.
      • We convert the canvas content to a Base64 encoded PNG image.
    2. Send Image to Hyperion:
      • We establish a WebSocket connection to the Hyperion server.
      • We send the image data along with the required parameters (width, height, imagedata, etc.) as a JSON object.
    3. Errors Encountered:
      • The Hyperion server returns errors indicating issues with the JSON data validation.
      • Specifically, the errors mention that height and width have "no schema definition" and imagedata is expected to be a string.
      • When we correct these, we get an error saying: "Size of image data does not match with the width and height".

    Current JSON Payload

    Here is an example of the JSON data we are sending to Hyperion:

    Hyperion Server Logs

    The logs on the Hyperion server show the following errors:

    Code
    2024-05-23T02:09:04.887Z [WEBSOCKET] (ERROR) While validating schema against json data of 'JsonRpc@::ffff:192.168.88.101':[root].height: no schema definition
    2024-05-23T02:09:04.887Z [WEBSOCKET] (ERROR) While validating schema against json data of 'JsonRpc@::ffff:192.168.88.101':[root].width: no schema definition
    2024-05-23T02:09:04.887Z [WEBSOCKET] (ERROR) While validating schema against json data of 'JsonRpc@::ffff:192.168.88.101':[root].format: Unknown enum value (allowed values are: ["auto"])
    2024-05-23T02:09:04.887Z [WEBSOCKET] (ERROR) While validating schema against json data of 'JsonRpc@::ffff:192.168.88.101':[root].imagedata: string expected

    When we fix the above errors, we encounter another error:

    Code
    "Size of image data does not match with the width and height"

    Here is the current JavaScript code we are using to capture the screen and send the image to Hyperion:


    Need assistance with the following:

    1. Correcting the JSON schema to match what Hyperion expects.
    2. Ensuring that the image data size matches the specified width and height.

    Any guidance or examples would be greatly appreciated!


    Thanks in advance!

    • Official Post

    GonzaCass Great project which you startet.


    The schema for 2.0.16 is this one: https://github.com/hyperion-pr…_schema/schema-image.json


    You are missing the "image" prefix before width and height.
    I would recommend that leaving the width and height out and let hyperion determine the size.
    To force an output size you can provide it via scale.
    I guess you wanted to have "scale": 120.


    For 2.0.17-beta1 you can also provide the instances as an array the image should be applied too. You can give ["all"] for all instances.

    hyperion.ng/libsrc/api/JSONRPC_schema/schema-image.json at master · hyperion-project/hyperion.ng
    The successor to Hyperion aka Hyperion Next Generation - hyperion-project/hyperion.ng
    github.com


    In addition, if you set "duration": 0, the image will not display, as the image effect will immediately stop.

    Provide duration = -1 for endless.


    In general, you might want to revisit the WebSocket approach fro streaming images to Hyperion.
    Other clients make use of a flatbuffer feed which will always be applied to all instances.
    In this postyou find the Hyperion flatbuffer definitions.

  • Lol I dont know why I made a reply and it get deleted.


    Well, here we go again:

    Thanks for your reply Lord-Grey. I was able to send correctly the JSON and I tested with a youtube video and it works and without any latency!


    Unfortunately, I made this with web app template on Tizen Studio and doing a lot of research it seems like I cant capture content outside this webapp. So, I'm doing more research now on how to capture the content of the screen even with the app closed, the real problem.


    Those flatbuffers are another way from sending the content right? I'll take a look to see if I can use those.


    In case that someone wants to try what I achieve, here is the code, I recommend to run it in Tizen Studio since I made it there.

    main.js:


    Edited 2 times, last by Lord-Grey ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!