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

Support to turn off loop and access HTML5 events/common methods #128

Merged
merged 15 commits into from
May 12, 2017
Merged

Support to turn off loop and access HTML5 events/common methods #128

merged 15 commits into from
May 12, 2017

Conversation

rafa8626
Copy link

@rafa8626 rafa8626 commented Mar 3, 2017

This PR solves #87

@googlebot
Copy link

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!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@rafa8626
Copy link
Author

rafa8626 commented Mar 3, 2017

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@rafa8626 rafa8626 changed the title Add VR View API to prevent video looping and access HTML5 events Support to turn off loop and access HTML5 events/common methods Mar 3, 2017
@rafa8626
Copy link
Author

@borismus Any updates on this?

@rafa8626
Copy link
Author

Is there anything I need to do for this to get merged? I'd like to use this with a more robust player

@ArthurvS
Copy link
Contributor

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.
Your duration function doesn't check if the video-proxy has been initiated.
In the world-render.js on line 75 you can add an if(this.scene.video)
And in the main.js you just have to place your is ready check inside the if(event.videoElement)

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

@rafa8626
Copy link
Author

Yes please feel free to create a pull request and I will be happy to review it and merge it

@tommytee
Copy link
Contributor

hi ron666, i forked your fork. added a scrubber bar (and some other stuff).
https://github.com/tommytee/vrview

@rafa8626
Copy link
Author

@tommytee Great! I'll take a look at it soon.

@rafa8626
Copy link
Author

Hi @ArthurvS any updates on the PR to fix both things you mentioned me above?

@ArthurvS
Copy link
Contributor

Hi @rafa8626,
Sorry for the delay, had a busy week! It is coming your way right now.
Cheers
Arthur

@googlebot
Copy link

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.

@rafa8626
Copy link
Author

rafa8626 commented Apr 10, 2017

@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.

@ArthurvS
Copy link
Contributor

I signed it!

… not included, better to do this locally at merge, cheers"

This reverts commit 03a2c7c.
@rafa8626
Copy link
Author

@borismus @ArthurvS signed the CLA but I still see that the commit is marked as failure. What can I do to fix this?

@googlebot
Copy link

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 cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@rafa8626
Copy link
Author

@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.

@ArthurvS
Copy link
Contributor

@rafa8626, np! happy to help!
@googlebot:
I'm okay with my commits being contributed to this project.,

@rafa8626
Copy link
Author

Thanks!

@kanaabe
Copy link

kanaabe commented Apr 17, 2017

Thanks for your work on this! I just pulled down your fork to play around with your changes but I'm seeing a console error when I test locally. Is there something I'm missing?

image

The error points to:
image

@rafa8626
Copy link
Author

@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

@rafa8626
Copy link
Author

@borismus Any chances of this getting merged in the master branch soon?

@@ -45,6 +61,9 @@ function onVRViewReady() {
} else {
playButton.classList.remove('paused');
}

// Set media on 00:02
vrView.setCurrentTime(2);
Copy link
Contributor

@borismus borismus Apr 29, 2017

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?

Copy link
Author

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

Copy link
Contributor

@borismus borismus left a 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.

@@ -67,4 +86,20 @@ function onToggleMute() {
muteButton.classList.toggle('muted');
}

function formatTime (time) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up random spaces.


var minutes = Math.floor(time / 60) % 60,
seconds = Math.floor(time % 60)
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: random semicolon?

Copy link
Author

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

@@ -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};
Copy link
Contributor

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_)

Copy link
Contributor

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.

Copy link
Author

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

@@ -75,6 +80,10 @@ Player.prototype.addHotspot = function(hotspotId, params) {
this.sender.send({type: Message.ADD_HOTSPOT, data: data});
};

/**
* HTML5 API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointless comment?

Copy link
Author

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

@@ -83,6 +92,10 @@ Player.prototype.pause = function() {
this.sender.send({type: Message.PAUSE});
};

/**
* Equivalent of HTML5 setSrc()
Copy link
Contributor

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.

@@ -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_;
Copy link
Contributor

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)

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be updateCurrentTime

type: 'ready'
type: 'ready',
data: {
duration: event.videoElement.duration
Copy link
Contributor

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?

Copy link
Author

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

VideoProxy.prototype.getCurrentTime = function() {
return {
currentTime: Util.isIOS9OrLess() ? this.audioElement.currentTime : this.videoElement.currentTime,
duration: Util.isIOS9OrLess() ? this.audioElement.duration : this.videoElement.duration
Copy link
Contributor

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.

Copy link
Author

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

@@ -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) {
Copy link
Contributor

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.

Copy link
Author

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

@rafa8626
Copy link
Author

I'll make the changes soon so this can be merged

@rafa8626
Copy link
Author

Thanks for reviewing this

@rafa8626
Copy link
Author

@borismus Please review this one more time. I have addressed all the issues you pointed out. Thanks.

@rafa8626
Copy link
Author

rafa8626 commented May 1, 2017

@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

@rafa8626
Copy link
Author

rafa8626 commented May 4, 2017

@borismus I added one last fix to display the hotspots since they were not showing up. Any updates on this?

@rafa8626
Copy link
Author

@borismus Any updates on this?

Copy link
Contributor

@borismus borismus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more nits.

console.log('media paused');
});
vrView.on('timeupdate', function(e) {
document.querySelector('#time').innerText = formatTime(e.currentTime) + ' | ' + formatTime(e.duration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line wrap

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change done

function formatTime (time) {
time = !time || typeof time !== 'number' || time < 0 ? 0 : time;

var minutes = Math.floor(time / 60) % 60,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use multiple var; declarations

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change done

@rafa8626
Copy link
Author

@borismus All changes requested have been completed. Is this good to be merged?

@borismus borismus merged commit ead7d94 into googlearchive:master May 12, 2017
@rafa8626
Copy link
Author

Thanks @borismus

@ArthurvS
Copy link
Contributor

Thanks @borismus & @rafa8626

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants