question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change audio url dynamically?

See original GitHub issue

Hi there,

How can I change my audio source dynamically? I have a player and select, select contains the information of the files, When the user selects the file, I want to change the URL of the player.

@angular/core: "^10.0.10"
@vime/angular: "^5.0.27"

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
ivanmirandastavenuitercommented, Sep 30, 2021

Why a library supposedly made to play video and audio do not offer the option of changing the track? Is not the most common thing in the world? Previous / Forward buttons… Have you ever seen a media player without them? I don’t understand this.

1reaction
Adrii77commented, Mar 8, 2022

Hey ! Just bind URL on [attr.data-src] from <source> element.

In my app :

<vm-audio>
   <source
     [attr.data-src]="(currentAudio$ | async).audioLink"
     type="audio/mp3" />
 </vm-audio>

 <vm-default-ui></vm-default-ui>
</vm-player>

currentAudio$ is an observable (from a BehaviorSubject in my case) which emits an object which contains an audio url (audioLink). I have a page where I can choose which sound I want to listen. Each of them contains a play button which next the audio object atfer a click.

Read more comments on GitHub >

github_iconTop Results From Across the Web

change <audio> src with javascript - html - Stack Overflow
Try this snippet. list.onclick = function(e) { e.preventDefault(); var elm = e.target; var audio = document.getElementById('audio'); var ...
Read more >
HTML DOM Audio src Property - W3Schools
The src property sets or returns the value of the src attribute of an audio. The src attribute specifies the location (URL) of...
Read more >
HTML Audio Player with Dynamic URL from Data Collection
Is there a way to create an HTML Component audio player on a dynamic page that plays an audio file from a URL...
Read more >
Video and Audio APIs - Learn web development | MDN
You can solve both these problems by hiding the native controls (by removing the controls attribute), and programming your own with HTML, CSS, ......
Read more >
How to play audio and dynamically change src
i then open chrome, navigate to “localhost:5006”, open the javascript console, click on Elements, and examine the DOM of the audio HTML tag....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found