Call this when the user clicks the play/pause button.
14558
def handle_play_pause_clicked(self):
        
        if self.__scan_hardware_source:
            if self.is_playing:
                self.__scan_hardware_source.stop_playing()
            else:
                self.__scan_hardware_source.start_playing()
353151
def pause_resume(self):
        """"""
        if self.is_paused():
            urlopen(self.url + "&mode=resume")
        else:
            urlopen(self.url + "&mode=pause")
584085
def on_click(self, handler):
        ''' 

        '''
        self.on_event(ButtonClick, handler)
        self.on_event(MenuItemClick, handler)
927572
function pause() {
        $this->paused = true;
        
        if($this->started && !$this->closed) {
            $this->driver->pauseStreamConsumption();
        }
    }
443117
def _on_enter(self, event):
        """"""
        self._id = self.master.after(int(self._timeout * 1000), func=self.show)
634285
function() {
          self._playLock = false;
          setParams();
          self._refreshBuffer(sound);

          // Setup the playback params.
          var vol = (sound._muted || self._muted) ? 0 : sound._volume;
          node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
          sound._playStart = Howler.ctx.currentTime;

          // Play the sound using the supported method.
          if (typeof node.bufferSource.start === 'undefined') {
            sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
          } else {
            sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
          }

          // Start a new timer if none is present.
          if (timeout !== Infinity) {
            self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
          }

          if (!internal) {
            setTimeout(function() {
              self._emit('play', sound._id);
              self._loadQueue();
            }, 0);
          }
        }
1247885
function togglePlay(originalEvent) {
    const { state: { config, paused } } = this;
    config.preserveItems = true;
    this.setState('paused', !paused);
    if (paused && !this.isMoving) {
        this.move(RIGHT);
    }
    emitAndFire(this, `carousel-${paused ? 'play' : 'pause'}`, { originalEvent });
}
519380
private void resume() {
        if (mIsPaused) {
            mIsPaused = false;
            mIsPausedAfterAudioFocusChanged = false;
            // Try to gain the audio focus before preparing and starting the media player.
            if (mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN)
                    == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
                mMediaPlayer.start();

                Intent intent = new Intent(PlaybackListener.ACTION_ON_TRACK_PLAYED);
                intent.putExtra(PlaybackListener.EXTRA_KEY_TRACK,
                        mPlayerPlaylist.getCurrentTrack());
                mLocalBroadcastManager.sendBroadcast(intent);

                updateNotification();
                mMediaSession.setPlaybackState(MediaSessionWrapper.PLAYBACK_STATE_PLAYING);
                resumeTimer();
            }
        }
    }
501449
def on_click(self, event):
        
        button = event["button"]
        if button in [1, 4, 5]:
            self.scrolling = True
            self._switch_selection()
        elif button == 3:
            self._apply()
739457
def _on_click(self, *args):
        
        if callable(self._callback):
            self._callback(self.selection)
1081554
public void pause() {
        new ExecutionChain(mGvrContext).runOnMainThread(new Runnable() {
            @Override
            public void run() {
                if (!mContentSceneViewStack.isEmpty()) {
                    mContentSceneViewStack.peek().hide();
                    WidgetLib.getTouchManager().setFlingHandler(null);
                }
            }
        }).execute();
    }
529227
def _play(self):
        """"""
        # Use pause command only for sources which support NETAUDIO
        if self._input_func in self._netaudio_func_list:
            body = {"cmd0": "PutNetAudioCommand/CurEnter",
                    "cmd1": "aspMainZone_WebUpdateStatus/",
                    "ZoneName": "MAIN ZONE"}
            try:
                if self.send_post_command(
                        self._urls.command_netaudio_post, body):
                    self._state = STATE_PLAYING
                    return True
                else:
                    return False
            except requests.exceptions.RequestException:
                _LOGGER.error("Connection error: play command not sent.")
                return False
843634
public void play() {

		// if play button itself is null, the whole purpose of AudioWife is
		// defeated.
		if (mPlayButton == null) {
			throw new IllegalStateException(ERROR_PLAYVIEW_NULL);
		}

		if (mUri == null) {
			throw new IllegalStateException("Uri cannot be null. Call init() before calling this method");
		}

		if (mMediaPlayer == null) {
			throw new IllegalStateException("Call init() before calling this method");
		}

		if (mMediaPlayer.isPlaying()) {
			return;
		}

		mProgressUpdateHandler.postDelayed(mUpdateProgress, AUDIO_PROGRESS_UPDATE_TIME);

		// enable visibility of all UI controls.
		setViewsVisibility();

		mMediaPlayer.start();

		setPausable();
	}
269295
function (options) {
      var player = this;

      // otherwise, the animation loop may try and play non-existant frames:
      this.pause();

      // this is called on the context of the recording
      var loadComplete = function (frames) {

        this.setFrames(frames);

        if (player.recording != this){
          console.log('recordings changed during load');
          return
        }

        if (player.autoPlay) {
          player.play();
          if (player.pauseOnHand && !player.controller.streaming() ) {
            player.setGraphic('connect');
          }
        }

        player.controller.emit('playback.recordingSet', this);
      };

      this.recording = options;

      // Here we turn the existing argument in to a recording
      // this allows frames to be added to the existing object via ajax
      // saving ajax requests
      if (!(options instanceof Recording)){

        this.recording.__proto__ = Recording.prototype;
        Recording.call(this.recording, {
          timeBetweenLoops: this.options.timeBetweenLoops,
          loop:             this.options.loop,
          loadProgress: function(recording, percentage, oEvent){
            player.controller.emit('playback.ajax:progress', recording, percentage, oEvent);
          }
        });

      }


      if ( this.recording.loaded() ) {

        loadComplete.call(this.recording, this.recording.frameData);

      } else if (options.url) {

        this.controller.emit('playback.ajax:begin', this, this.recording);

        // called in the context of the recording
        this.recording.loadFrameData(function(frames){
          loadComplete.call(this, frames);
          player.controller.emit('playback.ajax:complete', player, this);
        });

      } else if (options.compressedRecording) {
        this.recording.loadCompressedRecording(options.compressedRecording, function(frames){
          loadComplete.call(this, frames);
        });
      }


      return this;
    }
955149
function() {
          node.currentTime = seek;
          node.muted = sound._muted || self._muted || Howler._muted || node.muted;
          node.volume = sound._volume * Howler.volume();
          node.playbackRate = sound._rate;

          // Some browsers will throw an error if this is called without user interaction.
          try {
            var play = node.play();

            // Support older browsers that don't support promises, and thus don't have this issue.
            if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
              // Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
              self._playLock = true;

              // Set param values immediately.
              setParams();

              // Releases the lock and executes queued actions.
              play
                .then(function() {
                  self._playLock = false;
                  node._unlocked = true;
                  if (!internal) {
                    self._emit('play', sound._id);
                    self._loadQueue();
                  }
                })
                .catch(function() {
                  self._playLock = false;
                  self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
                    'on mobile devices and Chrome where playback was not within a user interaction.');

                  // Reset the ended and paused values.
                  sound._ended = true;
                  sound._paused = true;
                });
            } else if (!internal) {
              self._playLock = false;
              setParams();
              self._emit('play', sound._id);
              self._loadQueue();
            }

            // Setting rate before playing won't work in IE, so we set it again here.
            node.playbackRate = sound._rate;

            // If the node is still paused, then we can assume there was a playback issue.
            if (node.paused) {
              self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
                'on mobile devices and Chrome where playback was not within a user interaction.');
              return;
            }

            // Setup the end timer on sprites or listen for the ended event.
            if (sprite !== '__default' || sound._loop) {
              self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
            } else {
              self._endTimers[sound._id] = function() {
                // Fire ended on this audio node.
                self._ended(sound);

                // Clear this listener.
                node.removeEventListener('ended', self._endTimers[sound._id], false);
              };
              node.addEventListener('ended', self._endTimers[sound._id], false);
            }
          } catch (err) {
            self._emit('playerror', sound._id, err);
          }
        }
335089
function(nextDelay) {
            var delay = nextDelay || this.config.defaultDelay;

            if (delay && this._playing) {
                this._currentTimeout = setTimeout(function() {
                    this._executeStep(++this._current);
                }.bind(this), delay);
            }
        }
485885
function onPlayChange() {
		if (paused !== media.paused) {
			paused = media.paused;

			$(self.play, { 'aria-label': paused ? lang.play || 'play' : lang.pause || 'pause' });
			$(self.playSymbol, { 'aria-hidden': !paused });
			$(self.pauseSymbol, { 'aria-hidden': paused });

			clearInterval(interval);

			if (!paused) {
				// listen for time changes every 30th of a second
				interval = setInterval(onTimeChange, 34);
			}

			// dispatch new "playchange" event
			dispatchCustomEvent(media, 'playchange');
		}
	}