rn: adds support for mobile youtube link
This commit is contained in:
parent
e87167dd2d
commit
482ba23954
|
@ -76,7 +76,7 @@ export default class AbstractEnterVideoLinkPrompt<S: *> extends Component < Prop
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function getYoutubeLink(url) {
|
function getYoutubeLink(url) {
|
||||||
const p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;// eslint-disable-line max-len
|
const p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|(?:m\.)?youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;// eslint-disable-line max-len
|
||||||
const result = url.match(p);
|
const result = url.match(p);
|
||||||
|
|
||||||
return result ? result[1] : false;
|
return result ? result[1] : false;
|
||||||
|
|
|
@ -45,6 +45,13 @@ type Props = {
|
||||||
*/
|
*/
|
||||||
_isPlaying: string,
|
_isPlaying: string,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true when the status is set to stop and the view should not react to further changes.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_isStopped: boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if in landscape mode.
|
* True if in landscape mode.
|
||||||
*
|
*
|
||||||
|
@ -101,13 +108,6 @@ type Props = {
|
||||||
*/
|
*/
|
||||||
_seek: number,
|
_seek: number,
|
||||||
|
|
||||||
/**
|
|
||||||
* Set to true when the status is set to stop and the view should not react to further changes.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_shouldPrepareForStop: boolean,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Youtube id of the video to be played.
|
* Youtube id of the video to be played.
|
||||||
*
|
*
|
||||||
|
@ -138,11 +138,11 @@ const YoutubeLargeVideo = (props: Props) => {
|
||||||
const {
|
const {
|
||||||
_isOwner,
|
_isOwner,
|
||||||
_isPlaying,
|
_isPlaying,
|
||||||
_shouldPrepareForStop,
|
_isStopped,
|
||||||
_seek
|
_seek
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (shouldSetNewStatus(_shouldPrepareForStop, _isOwner, e, _isPlaying, time, _seek)) {
|
if (shouldSetNewStatus(_isStopped, _isOwner, e, _isPlaying, time, _seek)) {
|
||||||
props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
|
props._onVideoChangeEvent(props.youtubeId, e, time, props._ownerId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -201,7 +201,7 @@ const YoutubeLargeVideo = (props: Props) => {
|
||||||
* Return true if the user is the owner and
|
* Return true if the user is the owner and
|
||||||
* the status has changed or the seek time difference from the previous set is larger than 5 seconds.
|
* the status has changed or the seek time difference from the previous set is larger than 5 seconds.
|
||||||
*
|
*
|
||||||
* @param {boolean} shouldPrepareForStop - Once the status was set to stop, all the other statuses should be ignored.
|
* @param {boolean} isStopped - Once the status was set to stop, all the other statuses should be ignored.
|
||||||
* @param {boolean} isOwner - Whether the local user is sharing the video.
|
* @param {boolean} isOwner - Whether the local user is sharing the video.
|
||||||
* @param {string} status - The new status.
|
* @param {string} status - The new status.
|
||||||
* @param {boolean} isPlaying - Whether the component is playing at the moment.
|
* @param {boolean} isPlaying - Whether the component is playing at the moment.
|
||||||
|
@ -210,8 +210,8 @@ const YoutubeLargeVideo = (props: Props) => {
|
||||||
* @private
|
* @private
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function shouldSetNewStatus(shouldPrepareForStop, isOwner, status, isPlaying, newTime, previousTime) {
|
function shouldSetNewStatus(isStopped, isOwner, status, isPlaying, newTime, previousTime) {
|
||||||
if (shouldPrepareForStop) {
|
if (isStopped) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,12 +256,12 @@ function _mapStateToProps(state) {
|
||||||
_enableControls: ownerId === localParticipant.id,
|
_enableControls: ownerId === localParticipant.id,
|
||||||
_isOwner: ownerId === localParticipant.id,
|
_isOwner: ownerId === localParticipant.id,
|
||||||
_isPlaying: status === 'playing',
|
_isPlaying: status === 'playing',
|
||||||
|
_isStopped: status === 'stop',
|
||||||
_isWideScreen: responsiveUi.aspectRatio === ASPECT_RATIO_WIDE,
|
_isWideScreen: responsiveUi.aspectRatio === ASPECT_RATIO_WIDE,
|
||||||
_ownerId: ownerId,
|
_ownerId: ownerId,
|
||||||
_screenHeight: screenHeight,
|
_screenHeight: screenHeight,
|
||||||
_screenWidth: screenWidth,
|
_screenWidth: screenWidth,
|
||||||
_seek: time,
|
_seek: time
|
||||||
_shouldPrepareForStop: status === 'stop'
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue