Comments (18)
Within this task all changes should be made to make wavesurfer-react to support wavesurfer.js of version 7 and above
from wavesurfer-react.
If Region component is rendered from the start wavesurfer applies incorrect start and end properties there, i.e. instead of use passed ones it will use 0 and 0 if audio is not uploaded yet
from wavesurfer-react.
Also, only one instance of a plugin should be initiated during life-cycle of a component
from wavesurfer-react.
According to https://github.com/katspaugh/wavesurfer.js/blob/main/examples/regions.js, regions can be created right after decoding
event s emiitted
from wavesurfer-react.
I also think about a way to create a component like PluginController, that will be used like:
const example = (
<WaveSurfer {..._props}>
<WaveForm {...formProps}>
<PluginBridge Plugin={RegionsPlugin}>
{regions.map(reg => <Region {...reg} />)}
</PluginBridge>
</WaveForm>
</WaveSurfer>
);
Aim of plugin bridge is to control plugin life-cycle, i.e. currently plugin is registered via wavesurfer instance, but is destroyed by itself, wavesurfer just listens to 'destroy' event and removes plugin that emitted it.
from wavesurfer-react.
I also think about a way to create a component like PluginController, that will be used like:
const example = ( <WaveSurfer {..._props}> <WaveForm {...formProps}> <PluginBridge Plugin={RegionsPlugin}> {regions.map(reg => <Region {...reg} />)} </PluginBridge> </WaveForm> </WaveSurfer> );Aim of plugin bridge is to control plugin life-cycle, i.e. currently plugin is registered via wavesurfer instance, but is destroyed by itself, wavesurfer just listens to 'destroy' event and removes plugin that emitted it.
This way it would be easier to controll plugins used to build UI of wavesurfer. It would be easier to control same instances, i.e. avoiding PluginInstance recreation on each render on each plugin list creation.
For example, the following code shows how to use more than one plugin at the same time with the way proposed above:
const example = (
<WaveSurfer {..._props}>
<WaveForm {...formProps}>
<PluginBridge Plugin={RegionsPlugin} {...regionsPluginProps}>
{regions.map(reg => <Region {...reg} />)}
</PluginBridge>
<PluginBridge Plugin={TimelinePlugin} {...timelinePluginProps} />
<PluginBridge Plugin={MyAwesomePlugin} creator="createMyAwesome" {...timelinePluginProps} />
</WaveForm>
<div id="timeline" />
</WaveSurfer>
);
from wavesurfer-react.
This way is good enough, but what if some component will depend on both Regions and Timeline plugin...it should not take them from wavesurfer instance due to the fact that wavesurfer object in useState is not updated when something is destroyed.
from wavesurfer-react.
Thus...plugins list will be still in use for a while until better way to control plugins is found
from wavesurfer-react.
Also, there could be used two timelines at the same time, thus instanceof check alone is not suitable as solution to prevent plugin instance recreation.
It seems, additional field should be used along with instanceof check to differentiate different plugins...or...such field is required if more than one instance of one plugin is created.
from wavesurfer-react.
Found out a bug in wavesurfer.js - katspaugh/wavesurfer.js#3314, will continue to develop version 3 as like as this bug is already fixed.
from wavesurfer-react.
Found out a bug in wavesurfer.js - katspaugh/wavesurfer.js#3314, will continue to develop version 3 as like as this bug is already fixed.
Task was closed as not planned however I will try to investigate it further, because it should not work this way.
from wavesurfer-react.
Made extra investigation during which I created simple vanilla JS example replicating the same wrong behavior (link to the comment below): katspaugh/wavesurfer.js#3314 (comment)
from wavesurfer-react.
I will not recreate bug issue, but provide users of the package with a temporal solution to this bug of original package
from wavesurfer-react.
Found out a bug in wavesurfer.js - katspaugh/wavesurfer.js#3314, will continue to develop version 3 as like as this bug is already fixed.
Task was closed as not planned however I will try to investigate it further, because it should not work this way.
Task was reopened
from wavesurfer-react.
Markers plugins was deleted in wavesurferjs, instead Regions with content should be used.
Due to this fact I may leave Marker only by using Region component under the hood.
from wavesurfer-react.
Related Issues (20)
- prop-type dependency HOT 3
- How to setup on wavesurfer create parameters ? HOT 2
- ReferenceError: self is not defined HOT 4
- I can't fire events HOT 7
- useWavesurferHook
- Add functionality of updatable waveform params HOT 2
- Example of in use HOT 5
- Waveform customisation HOT 2
- Can not get zoom to work HOT 5
- Cannot use import statement outside a module HOT 7
- recreate timeline if its id is changed HOT 1
- "Cannot use import statement outside a module" with Next.js HOT 3
- getCurrentTime without triggering too much re-render on the Component HOT 2
- Is it possible to use this with Tauri / NextJS SSG? HOT 2
- generating new markers in component wrapped by <StrictMode> not rendering new markers HOT 4
- wavesurfer-react with react-beautiful-dnd issue HOT 5
- Align the button- Should be at the bottom of each waveform HOT 1
- Support content for regions HOT 3
- Support for wavesurfer.js 7+ HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wavesurfer-react.