2020-06-09 11:09:46 +08:00
|
|
|
import React from 'react';
|
2018-02-17 03:18:53 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import VideoProvider from './component';
|
2018-02-19 12:23:05 +08:00
|
|
|
import VideoService from './service';
|
2020-06-05 07:01:17 +08:00
|
|
|
import { withLayoutContext } from '/imports/ui/components/layout/context';
|
2018-02-17 03:18:53 +08:00
|
|
|
|
2018-12-18 06:19:26 +08:00
|
|
|
const VideoProviderContainer = ({ children, ...props }) => {
|
2020-06-09 11:09:46 +08:00
|
|
|
const { streams } = props;
|
2019-11-28 21:13:06 +08:00
|
|
|
return (!streams.length ? null : <VideoProvider {...props}>{children}</VideoProvider>);
|
2018-12-18 06:19:26 +08:00
|
|
|
};
|
2018-02-17 03:18:53 +08:00
|
|
|
|
2020-08-25 02:30:24 +08:00
|
|
|
export default withTracker(props => {
|
|
|
|
// getVideoStreams returns a dictionary consisting of:
|
|
|
|
// {
|
|
|
|
// streams: array of mapped streams
|
|
|
|
// totalNumberOfStreams: total number of shared streams in the server
|
|
|
|
// }
|
|
|
|
const {
|
|
|
|
streams,
|
|
|
|
totalNumberOfStreams
|
|
|
|
} = VideoService.getVideoStreams();
|
|
|
|
|
|
|
|
return {
|
|
|
|
swapLayout: props.swapLayout,
|
|
|
|
streams,
|
|
|
|
totalNumberOfStreams,
|
|
|
|
isUserLocked: VideoService.isUserLocked(),
|
|
|
|
currentVideoPageIndex: VideoService.getCurrentVideoPageIndex(),
|
|
|
|
};
|
2020-08-28 03:09:07 +08:00
|
|
|
})( withLayoutContext(VideoProviderContainer));
|