How to display default TV volume in Tizen web app?

I’m developing a web application for Tizen Smart TVs, and I need to display the current volume level of the TV on the screen when the app starts. I’ve been searching through the Tizen documentation but couldn’t find a clear way to retrieve the current volume level.

Can anyone guide me on how to get the default TV volume in a Tizen web app? Any code examples or pointers to the right APIs would be greatly appreciated!

Edit : I need to display the OnScreenDisplay of Volume when changing the volume, i know you can use tizen.tvaudiocontrol.setVolumeUp(); or tizen.tvaudiocontrol.setVolume(10); to change volume, but i don’t know how to display the OSD volume of samsung tv

Hello!
Certainly! Here’s a concise guide to display the volume level in a Tizen Smart TV web app:

JavaScript

// Display the current volume level when the app starts
function displayVolume() {
  var volume = tizen.tvaudiocontrol.getVolume();
  document.getElementById('volumeDisplay').innerText = 'Volume: ' + volume;
}

// Call this function at the start of your app
displayVolume();

// Update the volume display when volume is changed
function updateVolume(change) {
  change === 'up' ? tizen.tvaudiocontrol.setVolumeUp() : tizen.tvaudiocontrol.setVolumeDown();
  displayVolume();
}

// Bind these functions to your volume buttons
document.getElementById('volUp').addEventListener('click', () => updateVolume('up'));
document.getElementById('volDown').addEventListener('click', () => updateVolume('down'));

This code will show the current volume when your app starts and update the display when the volume is changed. For the OSD volume display, it’s typically controlled by the TV’s firmware and may not be accessible via Tizen Web APIs. You might need to create a custom overlay within your app to mimic this functionality. For the latest API details, refer to the Tizen documentation.

I hope this helps you.
The Disney Hub