Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(music): buttons to toggle playing and sound did`t work after play… #76

Merged
merged 1 commit into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(music): buttons to toggle playing and sound did`t work after play…
…ing 3rd song

fix #75
  • Loading branch information
ritz078 committed Jun 14, 2020
commit 84c9702170436ceaa2159dff6fccbcb2879f8fdc
1 change: 0 additions & 1 deletion renderer/components/Container/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default function () {

useEffect(() => {
function loadMagnetUri(_magnetUri: string) {
debugger;
if (!_magnetUri) return;
try {
const { name, infoHash }: MagnetUri.Instance = ParseTorrent(_magnetUri);
Expand Down
17 changes: 8 additions & 9 deletions renderer/components/MiniPlayer/MiniPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ export const MiniPlayer: React.FC<IProps> = memo(({ file }) => {
const playerRef = useRef<Plyr>(null);

useEffect(() => {
if (!file || file.type !== FileType.AUDIO) {
return () => {
playerRef.current?.destroy();
};
}, []);

useEffect(() => {
if (!file || file.type !== FileType.AUDIO) {
return;
}
if (playerRef.current) {
playerRef.current.source = {
type: "audio",
sources: [{ src: file.url }],
};
} else if (file) {
playerRef.current = new Plyr(audioRef.current);
}

playerRef.current = new Plyr(audioRef.current);
}, [file]);

const transitions = fadeInTranslateY(!!file && file.type === FileType.AUDIO);
Expand Down