mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
successfull howl player
This commit is contained in:
parent
f89a04e644
commit
c11e281965
2 changed files with 5 additions and 3 deletions
|
@ -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<HTMLDivElement> & {
|
||||
is_empty?: boolean;
|
||||
|
@ -53,7 +54,9 @@ const Comment: FC<IProps> = ({ comment, is_empty, is_loading, className, photo,
|
|||
{groupped.audio && (
|
||||
<div className={styles.audios}>
|
||||
{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>
|
||||
)}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue