1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

successfull howl player

This commit is contained in:
Fedor Katurov 2019-10-11 12:06:47 +07:00
parent f89a04e644
commit c11e281965
2 changed files with 5 additions and 3 deletions

View file

@ -10,6 +10,7 @@ import assocPath from 'ramda/es/assocPath';
import append from 'ramda/es/append'; import append from 'ramda/es/append';
import reduce from 'ramda/es/reduce'; import reduce from 'ramda/es/reduce';
import { UPLOAD_TYPES } from '~/redux/uploads/constants'; import { UPLOAD_TYPES } from '~/redux/uploads/constants';
import { Player } from '~/utils/player';
type IProps = HTMLAttributes<HTMLDivElement> & { type IProps = HTMLAttributes<HTMLDivElement> & {
is_empty?: boolean; is_empty?: boolean;
@ -53,7 +54,9 @@ const Comment: FC<IProps> = ({ comment, is_empty, is_loading, className, photo,
{groupped.audio && ( {groupped.audio && (
<div className={styles.audios}> <div className={styles.audios}>
{groupped.audio.map(file => ( {groupped.audio.map(file => (
<div key={file.id}>{file.name}</div> <div key={file.id} onClick={() => Player.setSrc(getURL(file.url))}>
{file.name}
</div>
))} ))}
</div> </div>
)} )}

View file

@ -4,8 +4,7 @@ Howl.prototype.setSrc = function setSrc(src) {
this.unload(); this.unload();
this._src = src; this._src = src;
this.load(); this.load();
this.play();
}; };
export const Player = new Howl({ src: [''] }); export const Player = new Howl({ src: [''] });
console.log('PLAYER', Player);