Socket
Socket
Sign inDemoInstall

react-audio-play

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-audio-play - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

dist/cjs/components/AudioLibrary.d.ts

7

dist/cjs/components/AudioPlayer.d.ts

@@ -1,5 +0,2 @@

declare type Props = {
style?: {};
};
export declare const AudioPlayer: (props: Props) => JSX.Element;
export {};
import { AudioTypeInterface } from './AudioTypeInterface';
export declare const AudioPlayer: (props: AudioTypeInterface) => JSX.Element;

@@ -8,6 +8,19 @@ "use strict";

const react_1 = __importDefault(require("react"));
const react_2 = require("react");
const AudioLibrary_1 = require("./AudioLibrary");
const AudioPlayer = (props) => {
return react_1.default.createElement("div", null, "AudioPlayer");
const audio = (0, react_2.useRef)(new AudioLibrary_1.AudioLibrary(props));
const [isPlaying, setIsPlaying] = (0, react_2.useState)(false);
const playOrStop = () => {
setIsPlaying(!isPlaying);
if (isPlaying) {
audio.current.stop();
}
else {
audio.current.play();
}
};
return react_1.default.createElement("button", { onClick: playOrStop }, isPlaying ? 'Stop' : 'Play');
};
exports.AudioPlayer = AudioPlayer;
//# sourceMappingURL=AudioPlayer.js.map

@@ -1,5 +0,2 @@

declare type Props = {
style?: {};
};
export declare const AudioPlayer: (props: Props) => JSX.Element;
export {};
import { AudioTypeInterface } from './AudioTypeInterface';
export declare const AudioPlayer: (props: AudioTypeInterface) => JSX.Element;
import React from 'react';
import { useRef, useState } from 'react';
import { AudioLibrary } from './AudioLibrary';
export const AudioPlayer = (props) => {
return React.createElement("div", null, "AudioPlayer");
const audio = useRef(new AudioLibrary(props));
const [isPlaying, setIsPlaying] = useState(false);
const playOrStop = () => {
setIsPlaying(!isPlaying);
if (isPlaying) {
audio.current.stop();
}
else {
audio.current.play();
}
};
return React.createElement("button", { onClick: playOrStop }, isPlaying ? 'Stop' : 'Play');
};
//# sourceMappingURL=AudioPlayer.js.map
{
"name": "react-audio-play",
"version": "0.0.3",
"version": "0.0.4",
"description": "React audio player component",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc