How to Become an Apple Registered Developer
How to Create an Xcode Project for an iPad App
How to Set Up a WeatherController in the Main_iPad.storyboard file for Your iOS App

Play, Pause, Stop, and Skip on the Samsung SmartTV's AV Player

The AVPlayer instance supports many API functions and basic player control events (play, pause, stop, skip) to control the player. The following list only covers the most basic player controller APIs.

  • Play player-controller API

    • open(String url, AVPlayOption)

      Initialize the player with a URL to load new content from

    • play()

      Play the loaded content

  • Control player-controller API

    • pause()

      Pause the player

    • resume()

      Resume the player

    • stop()

      Stop the player

    • jumpBackward(Number sec)

      Jump backward for the parameter seconds and play

    • jumpForward(Number sec)

      Jump forward for the parameter seconds and play

  • Setup player-controller API

    • setDisplayArea(Number x, Number y,
      Number width, Number height)

      Set the player area starting from the (x, y) position to the parameter width and height

  • Information player-controller API

    • duration

      Display total content length

    • videoWidth

      Display current screen width of the player

    • videoHeight

      Display current screen height of the player

Playing saved content

To play saved content, the player needs a path for the content. While the player can use both local and network media, streaming URL for network stored media is recommended. Absolute file path is required to play a locally stored media file.

image0.jpg

Once the AV Player is successfully initialized, use open() to set the URL for the playable content, then use play() to play the content.

The Samsung SmartTV supports the following media formats.

Playable Media Formats on the Samsung SmartTV 2012
Type Format TV/AV SDK 3.0
Streaming VOD HTTP Supported Supported
HTTPS Supported Supported
MMS Supported Supported
RTP/
RTSP
Supported Supported
Adaptive Streaming VOD Mpeg-Dash
(xml
metadata)
Supported
OIPF Rel2 / MPEG2 TSonly /AES-128
Supported
HLS
(m3u8
metadata)
Supported
- v3
Supported
- v3
HLS audio Supports High- Definition Audio with TS File Extension Only Supports High- Definition Audio with TS File Extension Only
Playable Media Formats on the Samsung SmartTV 2013
Type Format TV/AV SDK 4.0
Streaming VOD HTTP Supported Supported
HTTPS Supported Supported
MMS Supported Supported
RTP/
RTSP
Supported Supported
Adaptive Streaming VOD Mpeg-Dash
(xml
metadata)
Supported
OIPF Rel2 / MPEG2 TSonly /AES-128
Supported
HLS
(m3u8
metadata)
Supported
- v3
Supported
- v3
HLS audio Supports High- Definition Audio with TS File Extension Only Supports High- Definition Audio with TS File Extension Only

The Samsung SmartTV also supports adaptive streaming technology that reduces buffering by automatically adopting to a client network environment with variable quality playbacks.

Player pause and stop events

In addition to the play event, the pause and stop events are the most basic player control events. If a user presses the remote control stop or pause key, the player needs to correctly handle the user input. See the example for using stop() to stop a playback. The AVPlayer instance is already initialized.

// stop playback
Main.AVPlayer.stop();

The stop() function also needs to be called after completion of a playback. The AV Player provides onStreamCompleted() to handle the playback completion event.

The onStreamCompleted() function is included in the AVPlayerCallback API.

The pause() function works the same way.

// pause playback
Main.AVPlayer.pause();

The paused player needs to be resumed.

// resume paused playback
Main.AVPlayer.resume();

The preceding event functions can be called within the user key event handling code to create a working player with play, stop, and pause capabilities.

Skipping backward and forward

The AV Player supports skipping backward or forward in set seconds. It can be used to move playing content forward or backward for a specified amount of time. These functions are commonly bound to remote control buttons as their event-handling functions.

image1.jpg
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Add a Button to Your iOS App
How to Use the Library Pane for iOS App Development
How to Customize Xcode for Your iPad App
How to Add a New View Controller to Your iOS App
How to Join the Apple Developer Program
Advertisement

Inside Dummies.com