-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support to turn off loop and access HTML5 events/common methods #128
Conversation
…sending play event and updated demo file
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
@borismus Any updates on this? |
Is there anything I need to do for this to get merged? I'd like to use this with a more robust player |
Hi Ron, I download your changes to have the video duration checker in my own project but i noticed 2 minor errors when using a 360 image instead of video. If you want i can make a pull request for these 2 minor bugg fixes. Thanks for the feature it works really nice and is extremely helpfull |
Yes please feel free to create a pull request and I will be happy to review it and merge it |
hi ron666, i forked your fork. added a scrubber bar (and some other stuff). |
@tommytee Great! I'll take a look at it soon. |
Hi @ArthurvS any updates on the PR to fix both things you mentioned me above? |
Hi @rafa8626, |
…luded, better to do this locally at merge, cheers
…into ArthurvS-360Image_bugfix
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
@ArthurvS can you just sign the CLA and confirm you are OK with these changes being contributed to Google, please? Otherwise if they decide to merge this with master, the cannot merge it. Use this link Please visit https://cla.developers.google.com/ to sign. |
I signed it! |
… not included, better to do this locally at merge, cheers" This reverts commit 03a2c7c.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@ArthurvS sorry to bother you once more; just comment one more time including this text: I'm okay with my commits being contributed to this project. |
@rafa8626, np! happy to help! |
Thanks! |
@kanaabe Thanks for pointing this. I had a little merge error but now it's fixed; if you download the latest master branch from my fork you'll see this is solved |
@borismus Any chances of this getting merged in the master branch soon? |
examples/video/index.js
Outdated
@@ -45,6 +61,9 @@ function onVRViewReady() { | |||
} else { | |||
playButton.classList.remove('paused'); | |||
} | |||
|
|||
// Set media on 00:02 | |||
vrView.setCurrentTime(2); |
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.
Why not start at the beginning?
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.
Because it was to demonstrate the use of the method at a different time
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.
Left a few comments.
examples/video/index.js
Outdated
@@ -67,4 +86,20 @@ function onToggleMute() { | |||
muteButton.classList.toggle('muted'); | |||
} | |||
|
|||
function formatTime (time) { | |||
|
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.
Clean up random spaces.
examples/video/index.js
Outdated
|
||
var minutes = Math.floor(time / 60) % 60, | ||
seconds = Math.floor(time % 60) | ||
; |
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.
Style: random semicolon?
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.
No it's the closing one but I tend to leave it separately in the event I need to add more variables
src/api/player.js
Outdated
@@ -47,6 +47,11 @@ function Player(selector, contentInfo) { | |||
// Expose a public .isPaused attribute. | |||
this.isPaused = false; | |||
|
|||
// Other public attributes | |||
this.time_ = {currentTime: 0, duration: 0}; |
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.
Stick to the convention established in the rest of the file (this.time instead of this.time_)
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.
Also simplify by having this.currentTime and this.duration.
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.
Ok I'll separate them in 2 variables
src/api/player.js
Outdated
@@ -75,6 +80,10 @@ Player.prototype.addHotspot = function(hotspotId, params) { | |||
this.sender.send({type: Message.ADD_HOTSPOT, data: data}); | |||
}; | |||
|
|||
/** | |||
* HTML5 API |
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.
Pointless comment?
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.
I meant to expand the explanation on this but it can be removed
src/api/player.js
Outdated
@@ -83,6 +92,10 @@ Player.prototype.pause = function() { | |||
this.sender.send({type: Message.PAUSE}); | |||
}; | |||
|
|||
/** | |||
* Equivalent of HTML5 setSrc() |
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.
Use periods at the end of sentences.
src/api/player.js
Outdated
@@ -101,6 +114,29 @@ Player.prototype.setVolume = function(volumeLevel) { | |||
this.sender.send({type: Message.SET_VOLUME, data: data}); | |||
}; | |||
|
|||
Player.prototype.getVolume = function() { | |||
return this.volume_; |
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.
Use consistent spacing (2 spaces)
src/embed/main.js
Outdated
@@ -36,6 +36,7 @@ receiver.on(Message.PAUSE, onPauseRequest); | |||
receiver.on(Message.ADD_HOTSPOT, onAddHotspot); | |||
receiver.on(Message.SET_CONTENT, onSetContent); | |||
receiver.on(Message.SET_VOLUME, onSetVolume); | |||
receiver.on(Message.SET_CURRENT_TIME, onUpdateTime); |
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.
should be updateCurrentTime
src/embed/main.js
Outdated
type: 'ready' | ||
type: 'ready', | ||
data: { | ||
duration: event.videoElement.duration |
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.
Why do we provide duration in the ready call?
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.
Because I tried to make sure it's been set ahead of time. It's the behavior loadedmetadata will produce so the intention was to mimic it
src/embed/video-proxy.js
Outdated
VideoProxy.prototype.getCurrentTime = function() { | ||
return { | ||
currentTime: Util.isIOS9OrLess() ? this.audioElement.currentTime : this.videoElement.currentTime, | ||
duration: Util.isIOS9OrLess() ? this.audioElement.duration : this.videoElement.duration |
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.
Duration doesn't make sense to keep querying. It doesn't change.
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.
Agree. I'll remove it
src/embed/adaptive-player.js
Outdated
@@ -34,10 +34,12 @@ var DEFAULT_BITS_PER_SECOND = 1000000; | |||
* | |||
* To play/pause/seek/etc, please use the underlying video element. | |||
*/ | |||
function AdaptivePlayer() { | |||
function AdaptivePlayer(loop) { |
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.
This would be better as an opt_params with {loop: true}, for future proofness.
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.
Ok I see your point. I'll turn it into params
I'll make the changes soon so this can be merged |
Thanks for reviewing this |
… expand configuration of VR player
@borismus Please review this one more time. I have addressed all the issues you pointed out. Thanks. |
@borismus I just performed one last modification to the PR to solve some issues when using only images. Let me know if this is good to merge |
@borismus I added one last fix to display the hotspots since they were not showing up. Any updates on this? |
@borismus Any updates on this? |
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.
Some more nits.
examples/video/index.js
Outdated
console.log('media paused'); | ||
}); | ||
vrView.on('timeupdate', function(e) { | ||
document.querySelector('#time').innerText = formatTime(e.currentTime) + ' | ' + formatTime(e.duration); |
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.
Line wrap
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.
Change done
examples/video/index.js
Outdated
function formatTime (time) { | ||
time = !time || typeof time !== 'number' || time < 0 ? 0 : time; | ||
|
||
var minutes = Math.floor(time / 60) % 60, |
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.
Use multiple var; declarations
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.
Change done
@borismus All changes requested have been completed. Is this good to be merged? |
Thanks @borismus |
This PR solves #87