Instructs this buffer to resolve its underlying clip and be ready
to be played ASAP.
352381
public void resolve (Observer observer)
    {
        // if we were waiting to unload, cancel that
        if (_state == UNLOADING) {
            _state = LOADED;
            _manager.restoreClip(this);
        }

        // if we're already loaded, this is easy
        if (_state == LOADED) {
            if (observer != null) {
                observer.clipLoaded(this);
            }
            return;
        }

        // queue up the observer
        if (observer != null) {
            _observers.add(observer);
        }

        // if we're already loading, we can stop here
        if (_state == LOADING) {
            return;
        }

        // create our OpenAL buffer and then queue ourselves up to have
        // our clip data loaded
        AL10.alGetError(); // throw away any unchecked error prior to an op we want to check
        _buffer = new Buffer(_manager);
        int errno = AL10.alGetError();
        if (errno != AL10.AL_NO_ERROR) {
            log.warning("Failed to create buffer [key=" + getKey() +
                        ", errno=" + errno + "].");
            _buffer = null;
            // queue up a failure notification so that we properly return
            // from this method and our sound has a chance to register
            // itself as an observer before we jump up and declare failure
            _manager.queueClipFailure(this);

        } else {
            _state = LOADING;
            _manager.queueClipLoad(this);
        }
    }
680603
def pause(self):
		
		if self.decoder.status == mediadecoder.PAUSED:
			self.decoder.pause()
			self.paused = False
		elif self.decoder.status == mediadecoder.PLAYING:
			self.decoder.pause()
			self.paused = True
		else:
			print("Player not in pausable state")
1142615
protected void queueClipFailure (final ClipBuffer buffer)
    {
        _rqueue.postRunnable(new Runnable() {
            public void run () {
                _loading.remove(buffer.getKey());
                buffer.failed();
            }
        });
    }
267137
function WhammyRecorder(mediaStream) {
    // void start(optional long timeSlice)
    // timestamp to fire "ondataavailable"
    this.start = function(timeSlice) {
        timeSlice = timeSlice || 1000;

        mediaRecorder = new WhammyRecorderHelper(mediaStream, this);

        for (var prop in this) {
            if (typeof this[prop] !== 'function') {
                mediaRecorder[prop] = this[prop];
            }
        }

        mediaRecorder.record();

        timeout = setInterval(function() {
            mediaRecorder.requestData();
        }, timeSlice);
    };

    this.stop = function() {
        if (mediaRecorder) {
            mediaRecorder.stop();
            clearTimeout(timeout);
            this.onstop();
        }
    };

    this.onstop = function() {};

    this.clearOldRecordedFrames = function() {
        if (mediaRecorder) {
            mediaRecorder.clearOldRecordedFrames();
        }
    };

    this.pause = function() {
        if (!mediaRecorder) {
            return;
        }

        mediaRecorder.pause();
    };

    this.resume = function() {
        if (!mediaRecorder) {
            return;
        }

        mediaRecorder.resume();
    };

    this.ondataavailable = function() {};

    // Reference to "WhammyRecorder" object
    var mediaRecorder;
    var timeout;
}
454004
function( sample ) {
		this.bufferData[ this.bufferIndex++ ] = sample;

		if ( this.bufferIndex === this.bufferLength ) {
			this.bufferIndex = 0;

			if ( this.playing ) {
				this.playing.stop();
			}
			
			this.bufferSource.buffer = this.buffer;
			this.playing = this.bufferSource;
			this.playing.start( 0 );

			this.initBuffer();
		}
	}
960706
private void ensurePullAndPushRunning() {
        log.trace("State should be PLAYING to running this task: {}", subscriberStream.getState());
        if (pullMode && pullAndPush == null && subscriberStream.getState() == StreamState.PLAYING) {
            // client buffer is at least 100ms
            pullAndPush = subscriberStream.scheduleWithFixedDelay(new PullAndPushRunnable(), 10);
        }
    }
1261782
public void onHostActivityResumed() {
        synchronized (mReadyForFrameFence) {
            // Resume the GLSurfaceView's Renderer thread
            if (mDisplayView != null)
                mDisplayView.onResume();
            // Re-open camera if we're not recording and the SurfaceTexture has already been created
            if (!mRecording && mSurfaceTexture != null) {
                if (VERBOSE)
                    Log.i("CameraRelease", "Opening camera and attaching to SurfaceTexture");
                mHandler.sendMessage(mHandler.obtainMessage(MSG_REOPEN_CAMERA));
            } else {
                Log.w("CameraRelease", "Didn't try to open camera onHAResume. rec: " + mRecording + " mSurfaceTexture ready? " + (mSurfaceTexture == null ? " no" : " yes"));
            }
        }
    }
1032925
public void pause ()
    {
        if (_state != AL10.AL_PLAYING) {
            log.warning("Tried to pause stream that wasn't playing.");
            return;
        }
        _source.pause();
        _state = AL10.AL_PAUSED;
    }
734406
function(e) {
              that.environment = {
                flash:e.jPlayer.flash.used,
                html:e.jPlayer.html.used
              };
              that.flagPlayerReady = true;
              that.loadTrack(that.options.url);
              if(that.options.autoPlay) {
                if(that.environment.flash){
                  that.player.jPlayer('play');
                } else {
                  that.doOnCanPlay = function(){
                    that.player.jPlayer('play');
                  };
                }
              }
              that.options.onReady();
            }
338773
def handle_play_clicked(self):
        
        if self.__hardware_source:
            if self.is_playing:
                self.__hardware_source.stop_playing()
            else:
                self.__hardware_source.start_playing()
554187
@Override
    public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException, InterruptedException {
        if (!isResolving()) {
            setResolveInit();

            clearCandidates();

            if (fixedCandidate.getLocalIp() == null)
                fixedCandidate.setLocalIp(fixedCandidate.getIp());

            if (fixedCandidate != null) {
                addCandidate(fixedCandidate);
            }

            setResolveEnd();
        }
    }
1215504
public void handle(Buffer buffer) {
        if (buff == null) {
            buff = buffer;
        } else {
            buff.appendBuffer(buffer);
        }

        if(recordSize == -1) {
            fixedSizeMode(buff.getInt(0) + 4);
        }

        handleParsing();
    }
612904
def play(self):
		
		# Signal player to start video playback
		self.paused = False

		# Start listening for incoming audio frames
		if self.decoder.audioformat:
			self.audio.start()

		self.decoder.play()

		# While video is playing, render frames
		while self.decoder.status in [mediadecoder.PLAYING, mediadecoder.PAUSED]:
			texture_update_time = 0
			if self.texUpdated:
				t1 = time.time()
				# Update texture
				self.texture_locked = True
				glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, self.vidsize[0], 
					self.vidsize[1], GL_RGB, GL_UNSIGNED_BYTE, self.buffer)
				self.texture_locked = False
				texture_update_time = int((time.time()-t1)*1000)
				self.texUpdated = False
			
			# Draw the texture to the back buffer
			t1 = time.time()
			self.__drawFrame()
			draw_time = (time.time()-t1)*1000
			# Flip the buffer to show frame to screen
			t1 = time.time()
			pygame.display.flip()
			flip_time = (time.time()-t1)*1000

			logger.debug("================== Frame {} ========================"
				"".format(self.decoder.current_frame_no))
			if texture_update_time:
				logger.debug("Texture updated in {0} ms".format(texture_update_time))
			logger.debug("Texture drawn in {0} ms".format(draw_time))
			logger.debug("Screen flipped in {0} ms".format(flip_time))
			logger.debug("-----------------------------------------------------")
			logger.debug("Total: {} ms".format(texture_update_time+draw_time+flip_time))

			for e in pygame.event.get():
				if e.type == pygame.QUIT:
					self.stop()
				if e.type == pygame.KEYDOWN:
					# Quitting
					if e.key == pygame.K_ESCAPE:
						self.stop()
					# Pausing
					elif e.key == pygame.K_SPACE:
						self.pause()
					# Seeking
					elif e.key == pygame.K_RIGHT:
						new_time = min(
							self.decoder.current_playtime + 10,
							self.decoder.duration)
						self.decoder.seek(new_time)
					elif e.key == pygame.K_LEFT:
						new_time = max(
							self.decoder.current_playtime - 10,
							0)
						self.decoder.seek(new_time)

			pygame.event.pump()   # Prevent freezing of screen while dragging 

			# Without this sleep, the video rendering threard goes haywire...
			time.sleep(0.005)
		
		if self.decoder.audioformat:
			self.audio.close_stream()
				
		pygame.quit()
1137658
def set_frame
      frames = @animations[@playing_animation]
      case frames
      when Range
        reset_clipping_rect
        @clip_x = @current_frame * @clip_width
      when Array
        f = frames[@current_frame]
        @clip_x      = f[:x]      || @defaults[:clip_x]
        @clip_y      = f[:y]      || @defaults[:clip_y]
        @clip_width  = f[:width]  || @defaults[:clip_width]
        @clip_height = f[:height] || @defaults[:clip_height]
        @frame_time  = f[:time]   || @defaults[:frame_time]
      end
    end
1275315
private void initializePendingIntent(Context context) {

        // toggle playback
        Intent togglePlaybackIntent = new Intent(context, PlaybackService.class);
        togglePlaybackIntent.setAction(PlaybackService.ACTION_TOGGLE_PLAYBACK);
        mTogglePlaybackPendingIntent = PendingIntent.getService(context, REQUEST_CODE_PLAYBACK,
                togglePlaybackIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        // next track
        Intent nextPrendingIntent = new Intent(context, PlaybackService.class);
        nextPrendingIntent.setAction(PlaybackService.ACTION_NEXT_TRACK);
        mNextPendingIntent = PendingIntent.getService(context, REQUEST_CODE_NEXT,
                nextPrendingIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        // previous track
        Intent previousPendingIntent = new Intent(context, PlaybackService.class);
        previousPendingIntent.setAction(PlaybackService.ACTION_PREVIOUS_TRACK);
        mPreviousPendingIntent = PendingIntent.getService(context, REQUEST_CODE_PREVIOUS,
                previousPendingIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        // clear notification
        Intent clearPendingIntent = new Intent(context, PlaybackService.class);
        clearPendingIntent.setAction(PlaybackService.ACTION_CLEAR_NOTIFICATION);
        mClearPendingIntent = PendingIntent.getService(context, REQUEST_CODE_CLEAR,
                clearPendingIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    }
1125505
function (clip) {
    var canvas = this.canvas;
    var context = canvas.getContext('2d');
    morpheus.CanvasUtil.resetTransform(context);
    var width = this.getUnscaledWidth();
    var height = this.getUnscaledHeight();
    context.clearRect(0, 0, width, height);
    if (this.prePaint) {
      morpheus.CanvasUtil.resetTransform(context);
      context.translate(this.offset.x, this.offset.y);
      this.prePaint(clip, context);
    }
    morpheus.CanvasUtil.resetTransform(context);
    if (this.offscreenCanvas) {
      if (this.invalid) {
        var oc = this.offscreenCanvas.getContext('2d');
        morpheus.CanvasUtil.resetTransform(oc);
        context.translate(this.offset.x, this.offset.y);
        oc.clearRect(0, 0, width, height);
        this.draw(clip, oc);
      }
      if (width > 0 && height > 0) {
        context.drawImage(this.offscreenCanvas, 0, 0, width, height);
      }
    } else {
      this.draw(clip, context);
    }
    if (this.postPaint) {
      morpheus.CanvasUtil.resetTransform(context);
      context.translate(this.offset.x, this.offset.y);
      this.postPaint(clip, context);
    }
    this.lastClip = clip;
    this.invalid = false;
  }
671634
protected void prepare() throws IllegalStateException {
        Log.d(TAG, "prepare");
        startLoading();

        this.currentState = State.PREPARING;
        this.mediaPlayer.prepareAsync();
    }