-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* picture-in-picture * picture in picture support + player API + new icon * fixing in issue in mobile safari. webkitpresentationmode is updated after 'loadedmetadata' event is raised. Checking this after loadedmetadata event is updated. * removing redundant code * merge * moving this into the player class * removing redundant size
- Loading branch information
1 parent
0c0133e
commit 687426c
Showing
10 changed files
with
117 additions
and
5 deletions.
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
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,5 @@ | ||
.player{ | ||
.picture-in-picture{ | ||
|
||
} | ||
} |
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 @@ | ||
export {PictureInPicture} from './picture-in-picture'; |
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,79 @@ | ||
//@flow | ||
import style from '../../styles/style.scss'; | ||
import {h} from 'preact'; | ||
import {Localizer, Text} from 'preact-i18n'; | ||
import {default as Icon, IconType} from '../icon'; | ||
import {KeyMap} from '../../utils/key-map'; | ||
import BaseComponent from '../base'; | ||
import {connect} from 'preact-redux'; | ||
|
||
/** | ||
* mapping state to props | ||
* @param {*} state - redux store state | ||
* @returns {Object} - mapped state to this component | ||
*/ | ||
const mapStateToProps = state => ({ | ||
isPictureInPictureSupported: state.engine.isPictureInPictureSupported | ||
}); | ||
|
||
@connect(mapStateToProps) | ||
/** | ||
* PictureInPicture component | ||
* | ||
* @class PictureInPicture | ||
* @extends {BaseComponent} | ||
*/ | ||
class PictureInPicture extends BaseComponent { | ||
/** | ||
* Creates an instance of PictureInPicture. | ||
* @param {Object} obj - the object passed when created | ||
* @memberof PictureInPicture | ||
*/ | ||
constructor(obj: Object) { | ||
super({name: 'PictureInPicture', player: obj.player}); | ||
} | ||
|
||
/** | ||
* On PIP icon clicked | ||
* @returns {void} | ||
* @private | ||
*/ | ||
_onClick(): void { | ||
if (this.player.isInPictureInPicture()) { | ||
this.player.exitPictureInPicture(); | ||
} else { | ||
this.player.enterPictureInPicture(); | ||
} | ||
} | ||
|
||
/** | ||
* render component | ||
* | ||
* @returns {React$Element} - component element | ||
* @memberof RewindControl | ||
*/ | ||
render(): React$Element<any> | void { | ||
if (this.props.isPictureInPictureSupported) { | ||
return ( | ||
<div className={[style.controlButtonContainer, style.pictureInPicture].join(' ')}> | ||
<Localizer> | ||
<button | ||
tabIndex="0" | ||
aria-label={<Text id={'controls.PictureInPicture'} />} | ||
className={`${style.controlButton} ${this.state.animation ? style.rotate : ''}`} | ||
onClick={() => this._onClick()} | ||
onKeyDown={e => { | ||
if (e.keyCode === KeyMap.ENTER) { | ||
this._onClick(); | ||
} | ||
}}> | ||
<Icon type={IconType.PictureInPicture} /> | ||
</button> | ||
</Localizer> | ||
</div> | ||
); | ||
} | ||
} | ||
} | ||
|
||
export {PictureInPicture}; |
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