-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
feat: adds disablePictureInPicture method to the player API. #6378
Merged
gkatsev
merged 8 commits into
videojs:master
from
screen9:feat/add-disablepictureinpicture
Apr 22, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
815d0ca
feat: adds disablePictureInPicture method to the player API.
gjanblaszczyk 1b7697d
chore: adds more unit tests for PiP control
gjanblaszczyk 18c6d94
improves code quality for disablePictureInPicture method
gjanblaszczyk 8585d5c
adds demo page for disabling PiP functionality
gjanblaszczyk c11fd0e
improves demo page for disabling PiP functionality
gjanblaszczyk c19f4e1
Merge branch 'master' into feat/add-disablepictureinpicture
gjanblaszczyk 5e001b6
Add support for `disablepictureinpicturechanged` event.
gjanblaszczyk addc227
renames a method to make it more consistent.
gjanblaszczyk 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
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
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
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Video.js Sandbox</title> | ||
<link href="../dist/video-js.css" rel="stylesheet" type="text/css"> | ||
<script src="../dist/video.js"></script> | ||
</head> | ||
<body> | ||
<div style="background-color:#eee; border: 1px solid #777; padding: 10px; margin-bottom: 20px; font-size: .8em; line-height: 1.5em; font-family: Verdana, sans-serif;"> | ||
<p>You can use /sandbox/ for writing and testing your own code. Nothing in /sandbox/ will get checked into the repo, except files that end in .example (so don't edit or add those files). To get started run `npm start` and open the index.html</p> | ||
<pre>npm start</pre> | ||
<pre>open http://localhost:9999/sandbox/index.html</pre> | ||
</div> | ||
|
||
<video-js | ||
id="vid1" | ||
controls | ||
disablepictureinpicture | ||
preload="none" | ||
width="640" | ||
height="264" | ||
poster="http://vjs.zencdn.net/v/oceans.png"> | ||
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4"> | ||
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm"> | ||
<source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg"> | ||
<track kind="captions" src="../docs/examples/shared/example-captions.vtt" srclang="en" label="English"> | ||
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> | ||
</video-js> | ||
<p> | ||
PiP disabled via <b>disablepictureinpicture</b> attribute. | ||
</p> | ||
<video-js | ||
id="vid2" | ||
controls | ||
preload="auto" | ||
width="640" | ||
height="264" | ||
poster="http://vjs.zencdn.net/v/oceans.png"> | ||
<source src="http://vjs.zencdn.net/v/oceans.mp4" type="video/mp4"> | ||
<source src="http://vjs.zencdn.net/v/oceans.webm" type="video/webm"> | ||
<source src="http://vjs.zencdn.net/v/oceans.ogv" type="video/ogg"> | ||
<track kind="captions" src="../docs/examples/shared/example-captions.vtt" srclang="en" label="English"> | ||
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> | ||
</video-js> | ||
<p> | ||
PiP disabled via <b>disablePictureInPicture</b> player option. | ||
</p> | ||
<button id="PiPToggleBtn">call disablePictureInPicture(false) for the player 2</button> | ||
<script> | ||
var pipDisabled = true; | ||
var vid = document.getElementById('vid1'); | ||
var player = videojs(vid); | ||
|
||
var vid2 = document.getElementById('vid2'); | ||
var player2 = videojs(vid2, { | ||
controlBar: { | ||
pictureInPictureToggle: true | ||
}, | ||
disablePictureInPicture: true | ||
}); | ||
|
||
var pipToggle = document.getElementById('PiPToggleBtn'); | ||
pipToggle.addEventListener('click', function() { | ||
pipToggle.innerText = 'call disablePictureInPicture(' + pipDisabled + ') for the player 2'; | ||
pipDisabled = !pipDisabled; | ||
player2.disablePictureInPicture(pipDisabled); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
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
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
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
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
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
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
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.
thanks, though, I wonder if these tests even run anymore... 🤔