Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen mode #58

Open
BLamy opened this issue Mar 14, 2016 · 3 comments
Open

Fullscreen mode #58

BLamy opened this issue Mar 14, 2016 · 3 comments

Comments

@BLamy
Copy link
Contributor

BLamy commented Mar 14, 2016

I'd like to see a requestFullScreen method added to google-youtube so I can full screen my videos using my own chrome.

@ebidel
Copy link
Contributor

ebidel commented Mar 14, 2016

This is trivial to do without a fullscreen property:

<html>
<head>
<base href="https://polygit2.appspot.com/">  
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="components/google-youtube/google-youtube.html">
</head>
<body>

<google-youtube
  video-id="mN7IAaRdi_k"
  height="270px"
  width="480px"
  rel="0"
  start="5"
  autoplay="1">
</google-youtube>

  <button onclick="playFullscreen()">fullscreen</button>

<script>
function playFullscreen () {
  var video = document.querySelector('google-youtube');
  var requestFullScreen = video.requestFullScreen || video.mozRequestFullScreen || video.webkitRequestFullScreen;
  if (requestFullScreen) {
    requestFullScreen.bind(video)();
  }
}  
</script>
</body>
</html>

@BLamy
Copy link
Contributor Author

BLamy commented Mar 14, 2016

That's actually exactly what I was talking about, however, I was suggesting that the cross-browser code be abstracted behind this web component.

fullScreen: function() {
  var requestFullScreen = this.requestFullScreen || this.mozRequestFullScreen || this.webkitRequestFullScreen;
  if (requestFullScreen) {
    requestFullScreen.bind(this)();
  }
}

Personally, I think a fullscreen method kind of just 'fits' next to all of the convenience methods like play/pause:
https://github.com/GoogleWebComponents/google-youtube/blob/master/google-youtube.html#L459

@ebidel
Copy link
Contributor

ebidel commented Mar 14, 2016

Yea, I agree. It would be useful to just have this work. Want to submit a PR? Getting the sizing of the internal iframe right will be the tricky part. The FS API also needs to be triggered by a user-action, so calling it won't do much unless it's tied to custom UI (button click etc.)

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

No branches or pull requests

2 participants