Comments (2)
To attach a visualizer, it would be best to create the audio element first with an id, and then pass it in when instantiating IcecastMetadataPlayer. This is how the React demo page works.
<audio id="audio-source"><audio/>
<script>
const player = new IcecastMetadataPlayer("https://example.com/stream", {
audioElement: document.getElementById("audio-source")
});
// use the ID of your audio element anywhere else on your webpage
<script/>
If you have multiple streams on your webpage, and you want them to all use the same audio element, you'll need to call detachAudioElement()
before creating another instance of IcecastMetadataPlayer. The demo uses the changeStation
callback that is called when another station is clicked by: first stopping the player, then calling detachAudioElement()
before creating a new instance with the new stream endpoint.
icecast-metadata-js/src/demo/src/App.js
Lines 22 to 57 in 4229bad
from icecast-metadata-js.
It's working now!
Thank you!
from icecast-metadata-js.
Related Issues (20)
- Deferred module loading? HOT 1
- 'IcecastReadableStream' is not exported from 'icecast-metadata-js' (imported as 'IcecastReadableStream') HOT 8
- webaudio analyser ? HOT 3
- Full screen visualizer in demo
- multiple instances of metadata HOT 4
- icecast-metadata-stats NodeJS support HOT 6
- Authenticated streams not working? HOT 4
- CORS or header problem from icecast2 HOT 3
- iOS does not recognize playback correctly
- AbortError with streams from Icecast 2.4.0-kh22 HOT 10
- Uncaught ReferenceError: player is not defined HOT 8
- Play and replay issue on iOS HOT 9
- icecast-metadata-player retry / reconnect logic not working in iOS 17 HOT 1
- icecast-metadata-player - navigator.mediaSession.metadata not working in iOS HOT 3
- Pass custom parameter into icecast-metadata-player-1.17.1.main.min.js HOT 5
- Writing metadata to a file HOT 2
- ReferenceError: Worker is not defined HOT 5
- Audio stops playing after 5 seconds. HOT 4
- Unable to resume audio on iOS 17
- Repeated warnings when running in a Next.js app HOT 2
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 icecast-metadata-js.