Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apm-react-audio-player

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apm-react-audio-player - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

43

dist/index.js

@@ -97,2 +97,11 @@ 'use strict';

var isStream = audioRef.current && audioRef.current.currentSrc.includes('stream');
// Add a new state variable
var _useState11 = React.useState(false),
_useState12 = _slicedToArray(_useState11, 2),
isAudioReady = _useState12[0],
setIsAudioReady = _useState12[1];
console.log('🟡 audioRef', audioRef);
console.log('🟡 progressBarRef', progressBarRef);
console.log(' audioRef.current ', audioRef.current);
React.useEffect(function () {

@@ -102,8 +111,25 @@ if (currentTime === Number(duration)) {

setIsFinishedPlaying(true);
console.log('🟡 audioRef', audioRef);
console.log('⚪️ progressBarRef', progressBarRef);
if (progressBarRef.current) {
progressBarRef.current.style.setProperty('--seek-before-width', '0%');
}
}
}, [currentTime]);
var audio = audioRef.current;
// Define a function to set isAudioReady to true when the audio is ready
var handleCanPlayThrough = function handleCanPlayThrough() {
setIsAudioReady(true);
};
audio.addEventListener('canplaythrough', handleCanPlayThrough);
// Clean up the event listener on unmount
return function () {
audio.removeEventListener('canplaythrough', handleCanPlayThrough);
};
}, [isPlaying]);
var onLoadedMetadata = function onLoadedMetadata() {
var seconds = Math.floor(audioRef.current.duration);
setDuration(seconds);
if (!isStream) {
if (seconds !== Infinity) {
progressBarRef.current.max = seconds;

@@ -143,6 +169,9 @@ }

var play = function play() {
setIsPlaying(true);
setIsFinishedPlaying(false);
audioRef.current.play();
if (!isStream) {
if (isAudioReady) {
// if (!isStream) {
// animationRef.current = window.requestAnimationFrame(whilePlaying)
// }
setIsPlaying(true);
setIsFinishedPlaying(false);
audioRef.current.play();
animationRef.current = window.requestAnimationFrame(whilePlaying);

@@ -304,3 +333,3 @@ }

src: audioSrc,
preload: "none",
preload: "metadata",
onLoadedMetadata: onLoadedMetadata,

@@ -307,0 +336,0 @@ muted: isMuted

2

package.json
{
"name": "apm-react-audio-player",
"version": "1.0.16",
"version": "1.0.17",
"author": "Jason Phan <jphan@mpr.org>",

@@ -5,0 +5,0 @@ "license": "MIT",

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