WebDevStream: web development, Smart TV engineering, AI workflows and practical product notes.

Back to blog Samsung Smart TV

[Youtube Video] Playing a Video File in Samsung Smart TV – Part 2

July 15, 2026 3 min read YouTube video
Playing a Video File in Samsung Smart TV - Part 2

Building on the basics of video playback covered in part one, this tutorial explores a wider set of AVPlay class methods available in the Samsung Smart TV Web APIs library — including pause/resume, volume control, bitrate retrieval, duration, play speed, resolution, and video seeking.

Pause and Resume

The AVPlay class exposes a pause() method to halt playback without stopping the player. To resume, call resume() — but you need to track the current state to distinguish between an initial play and resuming from a pause. A simple playerState variable attached to the main object handles this:

  • On pause: set main.playerState = "paused" and call player.pause()
  • On play key press: check if the state is paused; if so call player.resume() instead of starting fresh

Map these actions to the remote’s Pause and Play key handlers for a natural user experience.

Displaying Player Properties — Bitrate, Volume, Duration, and Resolution

A properties panel in the UI demonstrates several read methods of the AVPlay class. These methods are best called after the video starts loading (with a short timeout to allow the player to populate values):

  • getAvailableBitrates() — returns the list of bitrates supported by the device or emulator
  • getCurrentBitrate() — returns the bitrate currently being used to render the video
  • getVolume() — retrieves the current volume level (0–100)
  • getDuration() — returns the total duration of the loaded video
  • getVideoResolution() — returns the resolution of the current video

Note that on the emulator, some values like getAvailableBitrates() may return -1 due to emulator limitations. On a real TV device these return accurate values.

Volume Control

Volume is controlled using setVolume(value) and read back using getVolume(). Map the volume up and volume down keys to increment/decrement the volume by 5 units, clamping the value between 0 and 100. After each change, update the UI display element with the new value from getVolume() to confirm the change.

Adjusting Play Speed

The AVPlay class includes a setSpeed(value) method that changes playback speed. A value of 1 is normal speed, while higher values increase the speed. In the tutorial, the number keys 1 and 3 on the remote are mapped to normal and fast speeds respectively, with the UI panel updating to reflect the current mode. The speed difference is clearly visible in the demo.

Seeking Forward and Backward

Seeking is implemented using jumpForward(milliseconds) and jumpBackward(milliseconds) methods on the player instance. In the tutorial, the fast-forward button seeks 10 seconds ahead and the rewind button seeks 10 seconds back. Using a local video server (node HTTP server) rather than a remote URL makes seeking much more responsive during development.

Resizing, Hiding, and Showing the Player

The setDisplayRect(left, top, width, height) method on the player instance dynamically resizes the player. In the demo, pressing key 5 maximizes the player to full window dimensions using window.innerWidth and window.innerHeight. Separately, the player container can be hidden and shown programmatically — pressing 4 hides the player, pressing 6 shows it — which is useful for displaying overlay UI elements on top of the video.

Watch the full video to see all of these controls implemented live in the Samsung Smart TV SDK emulator, including the visible effect of seeking, speed changes, and player resizing.

Advertisement

Stay connected

Get The Next Build Note

A quiet feed for new articles, videos, applications and project writeups

Newsletter

Join the WebDevStream build notes.

Receive recent posts, video lessons, application updates and project writeups.