Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #144 from bclwhitaker/pauseEvent
Browse files Browse the repository at this point in the history
Rename _isPlaying to _playbackStarted.
  • Loading branch information
heff committed Mar 17, 2015
2 parents 98cc1a6 + 4560db7 commit a6adcbf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Binary file modified dist/video-js.swf
Binary file not shown.
34 changes: 17 additions & 17 deletions src/com/videojs/providers/HTTPVideoProvider.as
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ package com.videojs.providers{

private var _src:Object;
private var _metadata:Object;
private var _isPlaying:Boolean = false;
private var _playbackStarted:Boolean = false;
private var _isPaused:Boolean = true;
private var _isBuffering:Boolean = false;
private var _isSeeking:Boolean = false;
Expand Down Expand Up @@ -117,7 +117,7 @@ package com.videojs.providers{
// if we have metadata and a known duration
if(_metadata != null && _metadata.duration != undefined){
// if playback has begun
if(_isPlaying){
if(_playbackStarted){
// if the asset can play through without rebuffering
if(_canPlayThrough){
return 4;
Expand Down Expand Up @@ -213,7 +213,7 @@ package com.videojs.providers{
}

public function get playing():Boolean{
return _isPlaying;
return _playbackStarted;
}

public function get paused():Boolean{
Expand Down Expand Up @@ -260,15 +260,15 @@ package com.videojs.providers{

public function load():void{
_pauseOnStart = true;
_isPlaying = false;
_playbackStarted = false;
initNetConnection();
}

public function play():void{
// if this is a fresh playback request
if(!_loadStarted){
_pauseOnStart = false;
_isPlaying = false;
_playbackStarted = false;
_metadata = {};
initNetConnection();
}
Expand All @@ -291,7 +291,7 @@ package com.videojs.providers{
public function pause():void{
var alreadyPaused = _isPaused;
_ns.pause();
if(!alreadyPaused){
if(_playbackStarted && !alreadyPaused){
_model.broadcastEventExternally(ExternalEventName.ON_PAUSE);
if(_isBuffering){
_pausePending = true;
Expand All @@ -300,7 +300,7 @@ package com.videojs.providers{
}

public function resume():void{
if(_isPlaying && _isPaused){
if(_playbackStarted && _isPaused){
_ns.resume();
_model.broadcastEventExternally(ExternalEventName.ON_RESUME);
if (!_isBuffering) {
Expand All @@ -310,7 +310,7 @@ package com.videojs.providers{
}

public function seekBySeconds(pTime:Number):void{
if(_isPlaying)
if(_playbackStarted)
{
_isSeeking = true;
_throughputTimer.stop();
Expand All @@ -321,7 +321,7 @@ package com.videojs.providers{
}
else if(_hasEnded)
{
_isPlaying = true;
_playbackStarted = true;
_hasEnded = false;
}

Expand All @@ -338,7 +338,7 @@ package com.videojs.providers{
}

public function seekByPercent(pPercent:Number):void{
if(_isPlaying && _metadata.duration != undefined){
if(_playbackStarted && _metadata.duration != undefined){
_isSeeking = true;
if(pPercent < 0){
_ns.seek(0);
Expand All @@ -356,9 +356,9 @@ package com.videojs.providers{
}

public function stop():void{
if(_isPlaying){
if(_playbackStarted){
_ns.close();
_isPlaying = false;
_playbackStarted = false;
_hasEnded = true;
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_CLOSE, {}));
_throughputTimer.stop();
Expand Down Expand Up @@ -524,7 +524,7 @@ package com.videojs.providers{

case "NetStream.Buffer.Full":
_pausedSeekValue = -1;
_isPlaying = true;
_playbackStarted = true;
if(_pausePending){
_pausePending = false;
_ns.pause();
Expand All @@ -537,13 +537,13 @@ package com.videojs.providers{

case "NetStream.Buffer.Empty":
// should not fire if ended/paused. issue #38
if(!_isPlaying){ return; }
if(!_playbackStarted){ return; }

// reaching the end of the buffer after endOfStream has been called means we've
// hit the end of the video
if (_ending) {
_ending = false;
_isPlaying = false;
_playbackStarted = false;
_isPaused = true;
_hasEnded = true;
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_CLOSE, {info:e.info}));
Expand All @@ -561,7 +561,7 @@ package com.videojs.providers{

case "NetStream.Play.Stop":
if(!_loop){
_isPlaying = false;
_playbackStarted = false;
_hasEnded = true;
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_CLOSE, {info:e.info}));
_model.broadcastEventExternally(ExternalEventName.ON_PAUSE);
Expand All @@ -576,7 +576,7 @@ package com.videojs.providers{
break;

case "NetStream.Seek.Notify":
_isPlaying = true;
_playbackStarted = true;
_isSeeking = false;
_model.broadcastEvent(new VideoPlaybackEvent(VideoPlaybackEvent.ON_STREAM_SEEK_COMPLETE, {info:e.info}));
_model.broadcastEventExternally(ExternalEventName.ON_SEEK_COMPLETE);
Expand Down

0 comments on commit a6adcbf

Please sign in to comment.