Skip to content

Development Guide

BrightCraft edited this page Oct 12, 2026 · 11 revisions

Build and Debug Methods for Moonlight Tizen


Build using Docker

The following method is intended for all Tizen developers, regardless of the Samsung TV model or Tizen version.

Building Moonlight via Docker

This section guides you through compiling the Moonlight application source code within a controlled Docker environment and preparing it for deployment. Once you have forked and cloned the repository locally, you must first ensure you meet the necessary prerequisites before proceeding. Follow these steps to build the Docker image, install the application, and launch it on the connected device.

Note

Before proceeding further with building the Moonlight app, you must have already installed WSL 2 and Docker Desktop on your system.

  1. Enable the Developer mode and find the TV IP Address on your Samsung TV by following these steps from the installation guide.
  2. Now, you need to run Docker Desktop and make sure to close any resource intensive applications.
  3. Open Windows PowerShell or a similar terminal depending on your OS, then change directory to the location where your repository is located:
    cd ~/Documents/GitHub/moonlight-tizen

    Note: If you are using Docker Desktop on a Mac with a silicon chip (M1/M2 etc), then you should change the first line in the Dockerfile to FROM --platform=linux/amd64 ubuntu:22.04 AS base before building the application to ensure compatibility.

  4. Then, enter the following command to build the Docker image from the source folder:
    docker build -t moonlight-tizen .

    Note: To build the Docker image without using any cached layers, append the --no-cache flag to the build command before the final period (e.g., docker build -t moonlight-tizen --no-cache .). Be aware that this operation may take a while, so please be patient!

  5. After that, enter the following command to run and enter the container:
    docker run -it --rm moonlight-tizen
  6. To proceed further, follow the steps below to install the application on your TV:
    • Enter the following command to connect to your Samsung TV over SDB (Smart Development Bridge):
    sdb connect YOUR_TV_IP

    Note: Replace YOUR_TV_IP with IP Address of your TV.

    • Next, enter the following command to confirm that you are connected, then take note of the Device ID:
    sdb devices

    Note: Just to clarify Device ID will be the last column, something like UE55AU7172UXXH.

    • Next, enter the following command to install the package:
    tizen install -n Moonlight.wgt -t YOUR_DEVICE_ID

    Note: Replace YOUR_DEVICE_ID with your TV model.

    • Next, enter the following command to exit the container:
    exit

    Note: Moonlight should now be available under Recent Apps on your Samsung TV.

  7. Optionally, enter the following command to remove the Docker image, unless you need it later:
    docker image rm moonlight-tizen

    Note: At the end you can enter the exit command to close the Windows PowerShell window.

Extracting the Moonlight package from Docker

After successfully building the Docker image (as described in the previous section), you may need to extract the application widget directly from the container’s filesystem. Follow the steps below to obtain the package file needed for installation and deployment on your connected device.

Note

Before proceeding further with extracting the files, confirm that the built Docker image is present locally.

  1. After entering the command to run the Docker container, you need to open Docker Desktop.
  2. Navigate to the Containers tab in the left sidebar and click on the name of your running container.
  3. Select the Files tab, where you can browse the container’s filesystem.
  4. Copy the application widget from the container by following these steps:
    • Find the home directory, select the moonlight folder, and here you can find Moonlight.wgt file.
    • Right-click on the file you want to save locally, select the Save option, and choose the location where you want to save it.
  5. You can now proceed with the further steps to install the application as described in the installation guide.

Additional Tizen CLI and SDB Commands

In addition to building and installing Moonlight, you can use the Tizen CLI and Smart Development Bridge (SDB) to inspect installed applications, launch Moonlight, and uninstall it when needed. The following commands are useful when testing builds, troubleshooting installation issues, or managing the application directly from the command line.

Note

Before executing these commands, ensure that your Samsung TV is connected and recognized by SDB. You can verify the connection by running sdb devices. Run the commands from an environment where the required Tizen CLI and SDB tools are available.

  • List installed applications: Display the applications installed on the TV.
    sdb shell 0 applist
  • List installed applications with additional details: Display a more detailed list of installed applications.
    sdb shell 0 vd_applist
  • Find Moonlight in the installed applications list: Filter the detailed list to show entries containing Moonlight.
    sdb shell 0 vd_applist | grep Moonlight
  • Launch Moonlight: Use either the Tizen CLI or SDB.
    tizen run -p MoonLightS.MoonlightWasm
    Alternatively:
    sdb shell 0 execute MoonLightS.MoonlightWasm
  • Uninstall Moonlight: Use either the Tizen CLI or SDB. This removes the application from the TV.
    tizen uninstall -p MoonLightS.MoonlightWasm
    Alternatively:
    sdb shell 0 vd_appuninstall MoonLightS.MoonlightWasm

If you need more details, check the Tizen CLI commands and SDB commands guides from Samsung’s official documentation.


Debugging and Collecting Logs

When developing or troubleshooting Moonlight Tizen, collecting runtime logs from the Samsung TV can help identify application errors, JavaScript exceptions, failed requests, and other issues. Moonlight runs on the TV, so its runtime logs must be collected from a debugging session connected to the TV, regardless of how the application was built.

Debugging Moonlight via Apps2Samsung

Apps2Samsung provides a convenient way to launch Moonlight in debug mode and inspect its live console output. This method is suitable for both developers investigating application behavior and end users collecting logs to report a problem.

Note

Before proceeding further with debugging the Moonlight app, you must have already installed and configured Apps2Samsung on your system.

  1. Open Apps2Samsung tool and connect to your Samsung TV as usual.
  2. Click Show installed apps option to view the applications installed on the TV:
    • Find the Moonlight app in the list and click its Debug button to open the Debug console window.
    • Apps2Samsung will stop Moonlight if it is already running, restart it in debug mode, and establish a tunnel from the TV’s debugging port to your local machine at http://127.0.0.1:9222.
    • A progress bar will appear at the top to indicate that the tunnel is active, and the applications list will be dimmed.
  3. Start inspecting the Moonlight app and collecting logs:
    • In the Debug console window, click the Open in browser button at the top to open the full TV web inspector (DevTools) in your default browser. Once it opens, you need to select the Console tab to view the logs in real-time.
    • To collect logs for an issue, keep the Console open while reproducing the problem. When you have captured the relevant output, right-click the console view and select Save As to save it as a file (e.g., MoonlightTizen-GENERATED_TIMESTAMP.log).
    • Developers can use the same console to inspect errors, investigate application behavior, and test implemented changes. They can also use other Web Inspector tools to inspect elements, examine application resources, and investigate runtime issues.
  4. Stop inspecting the Moonlight app after collecting logs:
    • To end the debugging session, close the DevTools window to close the web inspector and its debugging tunnel.
    • You can now close the open windows: Debug console, Installed apps, and the Apps2Samsung tool.
    • If you are collecting logs to report a problem, attach the saved log file to the relevant issue.

Debugging Moonlight via Tizen Studio

Tizen Studio provides an integrated development environment for deploying and debugging the Moonlight project on a connected Samsung TV. Its Web Inspector allows developers to examine console output, inspect application code, and investigate runtime behavior. This method is most useful when working directly with the source code, but it can also be used to collect logs from a pre-built application.

Note

Before proceeding further with debugging the Moonlight app, you must have already installed and configured Tizen Studio on your system.

  1. Ensure you have already imported the Tizen project and connected it to your Samsung TV by following the relevant steps.
  2. Open Tizen Studio and in the Project Explorer view:
    • Right-click on the Moonlight project, then go to Debug As and select Tizen Web Application as the launch mode.
    • The build and installation process will start within a few seconds, then you need to wait until it is complete.
    • Tizen Studio will stop Moonlight if it is already running, restart it in debug mode, and establish a tunnel from the TV’s debugging port to your local machine at http://127.0.0.1:GENERATED_PORT.
  3. Start inspecting the Moonlight app and collecting logs:
    • When the full TV web inspector (DevTools) opens in your default browser, you need to select the Console tab to view the logs in real-time.
    • To collect logs for an issue, keep the Console open while reproducing the problem. When you have captured the relevant output, right-click the console view and select Save As to save it as a file (e.g., MoonlightTizen-GENERATED_TIMESTAMP.log).
    • Developers can use the same console to inspect errors, investigate application behavior, and test implemented changes. They can also use other Web Inspector tools to inspect elements, examine application resources, and investigate runtime issues.
  4. Stop inspecting the Moonlight app after collecting logs:
    • To end the debugging session, close the DevTools window to close the web inspector and its debugging tunnel.
    • You can now close the open Tizen Studio window.
    • If you are collecting logs to report a problem, attach the saved log file to the relevant issue.

Debugging Moonlight via Docker

Docker is used to build Moonlight in the project’s development environment. If you build and install Moonlight using Docker, you can also launch the application in debug mode and inspect its runtime logs through the Web Inspector. This method is intended for developers who have built and installed Moonlight using Docker and want to investigate application without switching to Tizen Studio’s project deployment.

Note

Before proceeding further with debugging the Moonlight app, you must have already installed and configured Docker on your system.

  1. Ensure you have already run the Docker container, connected to your Samsung TV, and installed the package using the appropriate commands.
  2. Open a terminal in the environment where the SDB command-line tool is available, and enter the following command to start Moonlight in debug mode:
    sdb shell 0 debug "MoonLightS.MoonlightWasm"
    • SDB from the Docker container will stop Moonlight if it is already running, restart it in debug mode, and establish a tunnel from the TV’s debugging port to your local machine at http://YOUR_TV_IP:GENERATED_PORT.
    • Use the debugging address and port provided by the active terminal, then open your default browser and type http://YOUR_TV_IP:GENERATED_PORT, replacing YOUR_TV_IP with the IP address of your TV and GENERATED_PORT with the port generated by SDB.
  3. Start inspecting the Moonlight app and collecting logs:
    • When the full TV web inspector (DevTools) opens in your default browser, you need to select the Console tab to view the logs in real-time.
    • To collect logs for an issue, keep the Console open while reproducing the problem. When you have captured the relevant output, right-click the console view and select Save As to save it as a file (e.g., MoonlightTizen-GENERATED_TIMESTAMP.log).
    • Developers can use the same console to inspect errors, investigate application behavior, and test implemented changes. They can also use other Web Inspector tools to inspect elements, examine application resources, and investigate runtime issues.
  4. Stop inspecting the Moonlight app after collecting logs:
    • To end the debugging session, close the DevTools window to close the web inspector and its debugging tunnel.
    • You can now close the open Windows PowerShell window or whichever terminal you are using, depending on your OS.
    • If you are collecting logs to report a problem, attach the saved log file to the relevant issue.

This documentation is written by BrightCraft with great effort and dedication, providing detailed guidance, tips, and support to help users and developers use the Moonlight Tizen effectively.

Clone this wiki locally