From c11e2819658ec09063f94a43f4a8cf06c112675c Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Fri, 11 Oct 2019 12:06:47 +0700 Subject: [PATCH] successfull howl player --- src/components/node/Comment/index.tsx | 5 ++++- src/utils/player.ts | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/node/Comment/index.tsx b/src/components/node/Comment/index.tsx index bc730eba..ddc4b241 100644 --- a/src/components/node/Comment/index.tsx +++ b/src/components/node/Comment/index.tsx @@ -10,6 +10,7 @@ import assocPath from 'ramda/es/assocPath'; import append from 'ramda/es/append'; import reduce from 'ramda/es/reduce'; import { UPLOAD_TYPES } from '~/redux/uploads/constants'; +import { Player } from '~/utils/player'; type IProps = HTMLAttributes & { is_empty?: boolean; @@ -53,7 +54,9 @@ const Comment: FC = ({ comment, is_empty, is_loading, className, photo, {groupped.audio && (
{groupped.audio.map(file => ( -
{file.name}
+
Player.setSrc(getURL(file.url))}> + {file.name} +
))}
)} diff --git a/src/utils/player.ts b/src/utils/player.ts index 6371b575..121c20ca 100644 --- a/src/utils/player.ts +++ b/src/utils/player.ts @@ -4,8 +4,7 @@ Howl.prototype.setSrc = function setSrc(src) { this.unload(); this._src = src; this.load(); + this.play(); }; export const Player = new Howl({ src: [''] }); - -console.log('PLAYER', Player);