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

Commit

Permalink
Merge pull request #16 from FluorescentHallucinogen/screen-capture
Browse files Browse the repository at this point in the history
Add more attributes
  • Loading branch information
e111077 authored Jun 30, 2017
2 parents 2f53ebb + 76c6633 commit 5d788f6
Showing 1 changed file with 62 additions and 9 deletions.
71 changes: 62 additions & 9 deletions google-youtube-upload.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<link rel="import" href="./upload-import.html">

<!--
Element enabling you to upload videos to YouTube.
Element enabling you to record and upload videos to YouTube.
##### Examples
Manual upload with a `Video Upload` button once a video file is selected:
<google-youtube-upload client-id="..."></google-youtube-upload>
Automatic upload on video file select, with a custom title, and 'unlisted' privacy:
Automatic upload on video file select, with a custom title, and `unlisted` privacy:
<google-youtube-upload
auto
Expand All @@ -28,6 +28,39 @@
client-id="...">
</google-youtube-upload>
Record a device screen:
Screen sharing in Chrome and Firefox has some differences.
To capture the screen in Firefox use `{"mediaSource": "screen"}` video constraint:
<google-youtube-upload
video='{"mediaSource": "screen"}'
client-id="...">
</google-youtube-upload>
You can also use `{"mediaSource": "window"}` to capture only application window
and `{"mediaSource": "application"}` to capture all application windows,
not the whole screen.
NOTE: Firefox (before version 52) requires to set `media.getusermedia.screensharing.enabled`
to `true` and add the web app domain to `media.getusermedia.screensharing.allowed_domains`
in `about:config`.
To capture the screen in Chrome use `{"mandatory": {"chromeMediaSource": "screen"}}`
video constraint:
<google-youtube-upload
audio="false"
video='{"mandatory": {"chromeMediaSource": "screen"}}'
client-id="...">
</google-youtube-upload>
NOTE: As of today (April 23th, 2017), screen capturing in Chrome is available only on
Android and requires enabling `chrome://flags#enable-usermedia-screen-capturing` flag.
NOTE: Chrome doesn't support combining screen capture video tracks with audio tracks.
@demo
-->

Expand Down Expand Up @@ -301,10 +334,6 @@
* is enabled for your API project, and ensure that the JavaScript Origin
* is set to the domain hosting the page on which
* you'll be using this element.
*
* @attribute clientId
* @type string
* @default ''
*/
clientId: {
type: String,
Expand Down Expand Up @@ -363,7 +392,7 @@
* The [privacy setting](https://support.google.com/youtube/answer/157177?hl=en)
* for the new video.
*
* Valid values are 'public', 'private', and 'unlisted'.
* Valid values are `public`, `private`, and `unlisted`.
*/
privacyStatus: {
type: String,
Expand Down Expand Up @@ -393,6 +422,30 @@
value: Boolean('MediaRecorder' in window &&
'mediaDevices' in navigator &&
'getUserMedia' in navigator.mediaDevices)
},

/**
* The [MediaStream audio constraints](https://developer.mozilla.org/docs/Web/API/MediaStreamConstraints/audio).
*/
audio: {
type: Object,
value: true
},

/**
* The [MediaStream video constraints](https://developer.mozilla.org/docs/Web/API/MediaStreamConstraints/video).
*/
video: {
type: Object,
value: true
},

/**
* The media type.
*/
mimeType: {
type: String,
value: 'video/webm;codecs=vp9,vp8'
}
},

Expand Down Expand Up @@ -496,12 +549,12 @@
}

return navigator.mediaDevices.getUserMedia({
audio: true, video: true
audio: this.audio, video: this.video
}).then(function(stream) {
this.$$('#get-user-media').src = URL.createObjectURL(stream);
this._recordedBlobs = [];
this._mediaRecorder = new MediaRecorder(stream, {
mimeType: 'video/webm;codecs=vp9,vp8'
mimeType: this.mimeType
});

this._mediaRecorder.addEventListener('dataavailable', function(event) {
Expand Down

0 comments on commit 5d788f6

Please sign in to comment.