Class: Toybox::Media::PlaybackProfile

Inherits:
Lang::Object show all

Overview

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

Examples:

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:

  • 3.0.0

Instance Attribute Summary collapse

Method Summary

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Attribute Details

attemptSkipAfterThumbsDownToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


8406
8407
8408
# File 'Monkeybrains.rb', line 8406

def attemptSkipAfterThumbsDown
  @attemptSkipAfterThumbsDown
end

playbackControlsToybox::Lang::Array

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.

Returns:

Since:

  • 3.0.0


8400
8401
8402
# File 'Monkeybrains.rb', line 8400

def playbackControls
  @playbackControls
end

playbackNotificationThresholdToybox::Lang::Number

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.

Returns:

Since:

  • 3.0.0


8418
8419
8420
# File 'Monkeybrains.rb', line 8418

def playbackNotificationThreshold
  @playbackNotificationThreshold
end

playerColorsToybox::Media::PlayerColors

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

Returns:

Since:

  • 3.0.3


8432
8433
8434
# File 'Monkeybrains.rb', line 8432

def playerColors
  @playerColors
end

requirePlaybackNotificationToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


8411
8412
8413
# File 'Monkeybrains.rb', line 8411

def requirePlaybackNotification
  @requirePlaybackNotification
end

skipPreviousThresholdToybox::Lang::Number

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.

Returns:

Since:

  • 3.0.0


8426
8427
8428
# File 'Monkeybrains.rb', line 8426

def skipPreviousThreshold
  @skipPreviousThreshold
end