mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
Support for sync mode
This commit is contained in:
parent
37c2a2a1a8
commit
96238ee018
@ -212,7 +212,7 @@ export class SeekBar extends React.Component {
|
|||||||
<Slider
|
<Slider
|
||||||
size="small"
|
size="small"
|
||||||
value={this.state.sliderTime}
|
value={this.state.sliderTime}
|
||||||
disabled={this.props.stopped || this.props.streamMode}
|
disabled={this.props.stopped || this.props.streamMode || this.props.disabled}
|
||||||
min={0}
|
min={0}
|
||||||
max={100}
|
max={100}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
@ -275,6 +275,7 @@ const AudioPlayerChangeModeButton = (props) => {
|
|||||||
return <antd.Button
|
return <antd.Button
|
||||||
icon={createIconRender(modeToIcon[mode])}
|
icon={createIconRender(modeToIcon[mode])}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
|
disabled={props.disabled}
|
||||||
type="ghost"
|
type="ghost"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@ -290,9 +291,18 @@ export default class AudioPlayer extends React.Component {
|
|||||||
showControls: false,
|
showControls: false,
|
||||||
minimized: false,
|
minimized: false,
|
||||||
streamMode: false,
|
streamMode: false,
|
||||||
|
|
||||||
|
syncModeLocked: app.cores.player.getState("syncModeLocked"),
|
||||||
|
syncMode: app.cores.player.getState("syncMode"),
|
||||||
}
|
}
|
||||||
|
|
||||||
events = {
|
events = {
|
||||||
|
"player.syncModeLocked.update": (to) => {
|
||||||
|
this.setState({ syncModeLocked: to })
|
||||||
|
},
|
||||||
|
"player.syncMode.update": (to) => {
|
||||||
|
this.setState({ syncMode: to })
|
||||||
|
},
|
||||||
"player.livestream.update": (data) => {
|
"player.livestream.update": (data) => {
|
||||||
this.setState({ streamMode: data })
|
this.setState({ streamMode: data })
|
||||||
},
|
},
|
||||||
@ -353,6 +363,10 @@ export default class AudioPlayer extends React.Component {
|
|||||||
app.cores.player.close()
|
app.cores.player.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inviteSync = () => {
|
||||||
|
app.cores.sync.music.createSyncRoom()
|
||||||
|
}
|
||||||
|
|
||||||
updateVolume = (value) => {
|
updateVolume = (value) => {
|
||||||
app.cores.player.volume(value)
|
app.cores.player.volume(value)
|
||||||
}
|
}
|
||||||
@ -405,6 +419,15 @@ export default class AudioPlayer extends React.Component {
|
|||||||
onClick={this.minimize}
|
onClick={this.minimize}
|
||||||
shape="circle"
|
shape="circle"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{
|
||||||
|
!this.state.syncModeLocked && !this.state.syncMode && <antd.Button
|
||||||
|
icon={<Icons.MdShare />}
|
||||||
|
onClick={this.inviteSync}
|
||||||
|
shape="circle"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
<antd.Button
|
<antd.Button
|
||||||
icon={<Icons.X />}
|
icon={<Icons.X />}
|
||||||
onClick={this.close}
|
onClick={this.close}
|
||||||
@ -442,12 +465,15 @@ export default class AudioPlayer extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="controls">
|
<div className="controls">
|
||||||
<AudioPlayerChangeModeButton />
|
<AudioPlayerChangeModeButton
|
||||||
|
disabled={this.state.syncModeLocked}
|
||||||
|
/>
|
||||||
<antd.Button
|
<antd.Button
|
||||||
type="ghost"
|
type="ghost"
|
||||||
shape="round"
|
shape="round"
|
||||||
icon={<Icons.ChevronLeft />}
|
icon={<Icons.ChevronLeft />}
|
||||||
onClick={this.onClickPreviousButton}
|
onClick={this.onClickPreviousButton}
|
||||||
|
disabled={this.state.syncModeLocked}
|
||||||
/>
|
/>
|
||||||
<antd.Button
|
<antd.Button
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -455,6 +481,7 @@ export default class AudioPlayer extends React.Component {
|
|||||||
icon={this.state.streamMode ? <Icons.MdStop /> : playbackStatus === "playing" ? <Icons.MdPause /> : <Icons.MdPlayArrow />}
|
icon={this.state.streamMode ? <Icons.MdStop /> : playbackStatus === "playing" ? <Icons.MdPause /> : <Icons.MdPlayArrow />}
|
||||||
onClick={this.onClickPlayButton}
|
onClick={this.onClickPlayButton}
|
||||||
className="playButton"
|
className="playButton"
|
||||||
|
disabled={this.state.syncModeLocked}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
loading && <div className="loadCircle">
|
loading && <div className="loadCircle">
|
||||||
@ -470,6 +497,7 @@ export default class AudioPlayer extends React.Component {
|
|||||||
shape="round"
|
shape="round"
|
||||||
icon={<Icons.ChevronRight />}
|
icon={<Icons.ChevronRight />}
|
||||||
onClick={this.onClickNextButton}
|
onClick={this.onClickNextButton}
|
||||||
|
disabled={this.state.syncModeLocked}
|
||||||
/>
|
/>
|
||||||
<antd.Popover
|
<antd.Popover
|
||||||
content={React.createElement(
|
content={React.createElement(
|
||||||
@ -495,6 +523,7 @@ export default class AudioPlayer extends React.Component {
|
|||||||
stopped={playbackStatus === "stopped"}
|
stopped={playbackStatus === "stopped"}
|
||||||
playing={playbackStatus === "playing"}
|
playing={playbackStatus === "playing"}
|
||||||
streamMode={this.state.streamMode}
|
streamMode={this.state.streamMode}
|
||||||
|
disabled={this.state.syncModeLocked}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
.embbededMediaPlayerWrapper {
|
.embbededMediaPlayerWrapper {
|
||||||
position: absolute;
|
|
||||||
z-index: 300;
|
|
||||||
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
@ -14,8 +8,6 @@
|
|||||||
width: 270px;
|
width: 270px;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
|
|
||||||
margin: 40px;
|
|
||||||
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
|
||||||
pointer-events: initial;
|
pointer-events: initial;
|
||||||
@ -25,6 +17,9 @@
|
|||||||
&.minimized {
|
&.minimized {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
|
height: 0px;
|
||||||
|
width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hovering {
|
&.hovering {
|
||||||
@ -93,7 +88,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.extra_btns_wrapper{
|
.extra_btns_wrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
z-index: 330;
|
z-index: 330;
|
||||||
@ -105,21 +100,21 @@
|
|||||||
|
|
||||||
.extra_btns {
|
.extra_btns {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
transition: all 150ms ease-in-out;
|
transition: all 150ms ease-in-out;
|
||||||
|
|
||||||
//transform: translate(60%, 60%);
|
//transform: translate(60%, 60%);
|
||||||
|
|
||||||
.ant-btn {
|
.ant-btn {
|
||||||
background-color: var(--background-color-accent);
|
background-color: var(--background-color-accent);
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user