Did you just stumble upon this unexpected media error in the Chrome DevTools JavaScript Console? Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause().
or Uncaught (in promise) DOMException: The play() request was interrupted by a new load request.
Example: Play & Pause
<video id="video" preload="none" src="https://example.com/file.mp4"></video>
<script>
// Show loading animation.
var playPromise = video.play();
if (playPromise !== undefined) {
playPromise.then(_ => {
// Automatic playback started!
// Show playing UI.
// We can now safely pause video...
video.pause();
})
.catch(error => {
// Auto-play was prevented
// Show paused UI.
});
}
</script>
Have you got any code on your page that actually uses the Wix AudioPlayer API?
If you have any code on your page, please post it up here.
Aug 28, 2019
Wix Editor Elements ($w): Audio Player API
With the Audio Player API you can customize your Wix Audio Player . Now you can control your audio tracks programatically, customize your display, and add events as site visitors navigate your tracks
export function repeater1_itemReady($item, itemData, index) {
$w("#slider2").onChange((event) => {
$item = $w.at(event.context);
$item("#audioPlayer2").volume=event.target.value
})
}
The audioplayer in the repatear1 gets its mp3 url from the dataset. If i moved the audioplayer out of the repeater and set the volume etc programatically, again does nothing (so it seems the repeater is not the problem).
Okay can you show me a pic of your repeater layout, I need to see what the part under the music sheet image is like.
To me it looks like you have actually got the Wix Audio Player app set up in the condensed setting
and you have nothing happening on your page or in your code when the user clicks on the play button.
Also, these two lines shown at the bottom of this post…
The first one, what are you actually trying to do, something like this…
When each item is ready, the value of a text element is set to a value found in that specific item’s data.
As the second line is another function with the event handler just written into the code so you do not need to use the onChange event handler from the properties panel for that element.
export function repeater1_itemReady($item, itemData, index) {
Yes, the slider onChange function is for the volume.
However, what have you got in your code that plays the MP3 when the user clicks on the play arrow icon.
If you have not used the Wix Audio Player, then you should have an onClick function so that when the user clicks on the arrow it starts to play the file.
Nope. Ther is no playButton. There is the $w(audioplayer) element with the events listed in the API. It loads the infos from the dataset. As you may see, it loads everything image, text,) except the audio file!
So, it seems there is a serious problem/conflict with $w(audioplayer).
Well, thank you for your efforts, but we have to eat something
Okay so looking at your site, you have actually used the Wix Audio Player as the play button.
So note that this audioPlayer here is the Wix app and not the audioPlayer api.
If you have used this then can you simply try disconnecting the data connection and just on the first one add the external music url to the settings and see if that works.
You need to post an image of the elements in that play button area so I need to know what you are working with on your page.
How can you have no play button when there is one on the page that needs to be connected to the music file so that when the user clicks on it, then it knows where to play the file from?
If there was a major conflict, it would have already been picked up and reported.
Now, when I add the audioplayer on the page and connect to an mp3 file directly from the library (not the dataset) it loads and plays.
When it is in the repeater and connected to the dataset it does not load (while it used to load and play) and while other repeater items (images, text) are loaded ok.
To make it even simpler, when audioplayer is connected to a dataset (in or out a repeater) it does not load the mp3 url.
When it’s connected to the same url directly, it loads and plays.