This repository has been archived by the owner on Dec 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 311
Rename _isPlaying to _playbackStarted. #144
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -213,7 +213,7 @@ package com.videojs.providers{ | |
} | ||
|
||
public function get playing():Boolean{ | ||
return _isPlaying; | ||
return _playbackStarted; | ||
} | ||
|
||
public function get paused():Boolean{ | ||
|
@@ -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(); | ||
} | ||
|
@@ -291,7 +291,7 @@ package com.videojs.providers{ | |
public function pause():void{ | ||
var alreadyPaused = _isPaused; | ||
_ns.pause(); | ||
if(!alreadyPaused){ | ||
if(_playbackStarted && !alreadyPaused){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the important bit. |
||
_model.broadcastEventExternally(ExternalEventName.ON_PAUSE); | ||
if(_isBuffering){ | ||
_pausePending = true; | ||
|
@@ -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) { | ||
|
@@ -310,7 +310,7 @@ package com.videojs.providers{ | |
} | ||
|
||
public function seekBySeconds(pTime:Number):void{ | ||
if(_isPlaying) | ||
if(_playbackStarted) | ||
{ | ||
_isSeeking = true; | ||
_throughputTimer.stop(); | ||
|
@@ -321,7 +321,7 @@ package com.videojs.providers{ | |
} | ||
else if(_hasEnded) | ||
{ | ||
_isPlaying = true; | ||
_playbackStarted = true; | ||
_hasEnded = false; | ||
} | ||
|
||
|
@@ -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); | ||
|
@@ -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(); | ||
|
@@ -524,7 +524,7 @@ package com.videojs.providers{ | |
|
||
case "NetStream.Buffer.Full": | ||
_pausedSeekValue = -1; | ||
_isPlaying = true; | ||
_playbackStarted = true; | ||
if(_pausePending){ | ||
_pausePending = false; | ||
_ns.pause(); | ||
|
@@ -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})); | ||
|
@@ -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); | ||
|
@@ -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); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
playbackStarted to me sounds like the video has started playing but may currently be paused or playing. Is that what this is meant to be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, that's it exactly and why I thought the original name was misleading...
@heff this line in particular was confusing to read.
https://github.com/videojs/video-js-swf/blob/master/src/com/videojs/providers/HTTPVideoProvider.as#L303
Perhaps this isn't a good name either though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, from what @bclwhitaker and I understood, this is what this variable actually means. It's true from when a user as pressed play/seeked and until the video has ended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. The
playing()
function is pretty poorly named too then. Thanks for clearing that up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bclwhitaker yeah
_isPlaying && _isPaused
is ridiculous. In core we have thevjs-has-started
class if you're looking for similar naming, though I've considered changing that tovjs-played
to matchvjs-ended
and the video element'splayed
property. What you have here is good though.