Class: Toybox.Media.PlaybackProfile

Overview

Provides the media player with specific rules about what playback options are supported.

Example:

an example of the PlaybackProfile object

// Returns the playback profile
function getPlaybackProfile() {
   var profile = new PlaybackProfile();

   // Set the parameters for the PlaybackProfile.playbackControls
   profile.playbackControls = [
       Media.PLAYBACK_CONTROL_PLAYBACK,      // Allow Play/Pause control
       Media.PLAYBACK_CONTROL_SHUFFLE,       // Allow Shuffle control
       Media.PLAYBACK_CONTROL_PREVIOUS,      // Allow Previous control
       Media.PLAYBACK_CONTROL_NEXT,          // Allow Next control
       Media.PLAYBACK_CONTROL_SKIP_FORWARD,  // Allow Skip-Forward control
       Media.PLAYBACK_CONTROL_SKIP_BACKWARD, // Allow Skip-Backward control
       Media.PLAYBACK_CONTROL_REPEAT,        // Allow Repeat control
       Media.PLAYBACK_CONTROL_RATING         // Allow Ratings control
   ];

   // Skip media content on thumbs-down
   profile.attemptSkipAfterThumbsDown = true;

   // Do not require playback notification
   profile.requirePlaybackNotification = false;

   // Set the notification threshold to 30 seconds
   profile.playbackNotificationThreshold = 30;

   // Set the skip previous threshold to 5 seconds
   profile.skipPreviousThreshold = 5;

   return profile;
}

Since:

API Level 3.0.0

Instance Member Summary collapse

Instance Attribute Details

var attemptSkipAfterThumbsDown as Lang.Boolean or Null

Defines if the current song is skipped if a thumbs-down operation is given

Since:

API Level 3.0.0

Returns:

var playbackControls as Lang.Array<Media.PlaybackControl or Media.CustomButton or Media.SystemButton> or Null

Playback controls that should be rendered in the player.

This is an Array that holds a combination of PLAYBACK_CONTROL_*, CustomButton, and SystemButton values defined by the developer. The values in this Array determine which native media player control options are rendered and available to the end user of the current device. The first entry in the array may be used as a hotkey in the media player. This is device dependent.

Since:

API Level 3.0.0

Returns:

var playbackNotificationThreshold as Lang.Number or Null

The number of seconds a song must play to trigger a "played" notification. A value of 0 means notify as soon as the song begins playing.

Since:

API Level 3.0.0

Returns:

var playerColors as Media.PlayerColors or Null

The colors for the media player. If set to null the default colors that are device-dependent will be used.

Since:

API Level 3.0.3

Returns:

var requirePlaybackNotification as Lang.Boolean or Null

Defines if the system notifies the app when each song is played

Since:

API Level 3.0.0

Returns:

var skipBackwardTimeDelta as Lang.Number or Null

The number of seconds to move backward in a track during a skip backward event. If set to null the default value of 30 seconds will be used.

Note:

When overriding the default value, it will be necessary to provide a custom icon for the skip backward button, as the default indicates 30 seconds. This can be done by returning a PlaybackProfile with custom playbackControls from getPlaybackProfile().

Since:

API Level 4.2.4

Returns:

var skipForwardTimeDelta as Lang.Number or Null

The number of seconds to move forward in a track during a skip forward event. If set to null the default value of 30 seconds will be used.

Note:

When overriding the default value, it will be necessary to provide a custom icon for the skip forward button, as the default indicates 30 seconds. This can be done by returning a PlaybackProfile with custom playbackControls from getPlaybackProfile().

Since:

API Level 4.2.4

Returns:

var skipPreviousThreshold as Lang.Number or Null

The amount of time a song must be played so that pressing back restarts the track and requires a second back press to skip to the previous track in seconds. If set to null a default value that is device-dependent will be used.

Since:

API Level 3.0.0

Returns:


Generated Apr 17, 2024 9:40:38 AM