Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When initializing, song does not work properly with an empty object #470

Open
HsienW opened this issue Aug 20, 2021 · 1 comment
Open

When initializing, song does not work properly with an empty object #470

HsienW opened this issue Aug 20, 2021 · 1 comment
Labels
Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated.

Comments

@HsienW
Copy link

HsienW commented Aug 20, 2021

Issue description

I refer #466
when I was initializing, song used an empty object, and then I wanted to use addPlaylist to dynamically update the playlist, but it didn't work properly, and it would generate "Uncaught (in promise) DOMException: The element has no supported sources." error

import

import amplitude from 'amplitudejs';

    constructor() {
        super();
        this.amplitude = amplitude;
    }

initializing:

this.amplitude.init({
            songs: [
                {
                    url: "" // this
                }
            ],
            callbacks: {
               ...
            }
        });

addPlaylist & play :

        this.amplitude.addPlaylist(
            'current_starting_playlist',
            {
                name: 'test',
                title: 'test',
                author: 'test'
            },
            [
                {
                    "name": "Money Changes Everything",
                    "artist": "Cyndi Lauper",
                    "album": "She's So Unusual",
                    "url": "https://p.scdn.co/mp3-preview/01bb2a6c9a89c05a4300aea427241b1719a26b06",
                    "cover_art_url": "https://i.scdn.co/image/54b3222c8aaa77890d1ac37b3aaaa1fc9ba630ae"
                },
                {
                    "name": "Pyttefolk och tigerstekar i hängmattan",
                    "artist": "Bronsåldersstadens kollaps",
                    "album": "Hot Fuss",
                    "url": "https://p.scdn.co/mp3-preview/7a785904a33e34b0b2bd382c82fca16be7060c36",
                    "cover_art_url": "https://521dimensions.com/img/open-source/amplitudejs/album-art/guidance.jpg"
                }
            ]);

        this.amplitude.play();

Environment

Version: 5.3.2

Steps to reproduce the issue

  1. click " test add playlist"

What is expected?

Dynamically update current playlist

Link to where issue can be reproduced

I copied blue player and added a test add playlist dom to bind the call function.
Reproduce codepen link: https://codepen.io/hsienw/pen/yLbmpgG?editors=1111

Additional details / screenshots

image

@HsienW HsienW added the Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated. label Aug 20, 2021
@Maenny
Copy link

Maenny commented Feb 24, 2022

I have a similar problem (Just using global songs instead of playlist).

I was able to get it to work with playNow(s):

Amplitude.addSong( {song object } );
Amplitude.playNow(Amplitude.getSongs()[0]);

BUT it seems, that with this approach the callbacks won't fire...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Needs Confirmation 🧐 Bugs that are reported, but needs to be confirmed and replicated.
Projects
None yet
Development

No branches or pull requests

2 participants