Fast lite mode #129
3 changed files with 135 additions and 0 deletions
|
@ -5,6 +5,7 @@ import DiscoverPage from 'page/discover';
|
|||
import DownloadsPage from 'page/downloads';
|
||||
import DrawerContent from 'component/drawerContent';
|
||||
import FilePage from 'page/file';
|
||||
import LiteFilePage from 'page/liteFile';
|
||||
import FirstRunScreen from 'page/firstRun';
|
||||
import InvitesPage from 'page/invites';
|
||||
import PublishPage from 'page/publish';
|
||||
|
@ -277,6 +278,12 @@ const mainStackNavigator = new createStackNavigator(
|
|||
drawerLockMode: 'locked-closed',
|
||||
},
|
||||
},
|
||||
LiteFile: {
|
||||
screen: LiteFilePage,
|
||||
navigationOptions: {
|
||||
drawerLockMode: 'locked-closed',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
headerMode: 'none',
|
||||
|
|
34
src/page/liteFile/index.js
Normal file
34
src/page/liteFile/index.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectContentPositionForUri,
|
||||
selectBalance,
|
||||
from 'lbry-redux';
|
||||
import {
|
||||
doClaimEligiblePurchaseRewards,
|
||||
makeSelectViewCountForUri,
|
||||
} from 'lbryinc';
|
||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||
import FilePage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { uri, fullUri } = props.navigation.state.params;
|
||||
const contentUri = fullUri || uri;
|
||||
const selectProps = { uri: contentUri };
|
||||
return {
|
||||
balance: selectBalance(state),
|
||||
isPlayerVisible: makeSelectPlayerVisible(uri)(state), // use navigation uri for this selector
|
||||
position: makeSelectContentPositionForUri(contentUri)(state),
|
||||
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||
setPlayerVisible: (visible, uri) => dispatch(doSetPlayerVisible(visible, uri)),
|
||||
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform,
|
||||
)(LiteFilePage);
|
94
src/page/liteFile/view.js
Normal file
94
src/page/liteFile/view.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
import React from 'react';
|
||||
import { Lbry, formatCredits, normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
DeviceEventEmitter,
|
||||
Dimensions,
|
||||
Image,
|
||||
Linking,
|
||||
NativeModules,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
TouchableWithoutFeedback,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import MediaPlayer from 'component/mediaPlayer';
|
||||
import filePageStyle from 'styles/filePage';
|
||||
import uriBarStyle from 'styles/uriBar';
|
||||
|
||||
// This page will only be used for playing audio / video content from a remote stream URL
|
||||
class LiteFilePage extends React.PureComponent {
|
||||
|
||||
playerBackground = null;
|
||||
|
||||
scrollView = null;
|
||||
|
||||
player = null;
|
||||
|
||||
state = {
|
||||
fullscreenMode: false,
|
||||
playerHeight: null,
|
||||
}
|
||||
|
||||
getStreamUrl = (uri) => {
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const { contentUri } = this.props;
|
||||
|
||||
const playerStyle = [
|
||||
filePageStyle.player,
|
||||
this.state.isLandscape
|
||||
? filePageStyle.containedPlayerLandscape
|
||||
: this.state.fullscreenMode
|
||||
? filePageStyle.fullscreenPlayer
|
||||
: filePageStyle.containedPlayer,
|
||||
];
|
||||
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
|
||||
|
||||
<View
|
||||
style={
|
||||
this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer
|
||||
}
|
||||
onLayout={this.checkOrientation}
|
||||
>
|
||||
<MediaPlayer
|
||||
claim={claim}
|
||||
assignPlayer={ref => {
|
||||
this.player = ref;
|
||||
}}
|
||||
uri={uri}
|
||||
source={this.playerUriForFileInfo(fileInfo)}
|
||||
style={playerStyle}
|
||||
autoPlay
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onLayout={evt => {
|
||||
if (!this.state.playerHeight) {
|
||||
this.setState({ playerHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)}
|
||||
onBackButtonPressed={this.onBackButtonPressed}
|
||||
onPlaybackStarted={this.onPlaybackStarted}
|
||||
onPlaybackFinished={this.onPlaybackFinished}
|
||||
thumbnail={thumbnail}
|
||||
position={position}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default LiteFilePage;
|
Loading…
Reference in a new issue