Comment 1 for bug 1541720

Revision history for this message
ric silva (ricardo-garcia-silva) wrote :

I eventually got it working.

I had to pass a an object as the second argument to the add_attribute_value() method. Like this:

audio.add_attribute_value(
    "tracks",
    {
            "title": result.get("title"),
            "source": result.get("audio_preview_url")
    }
);

This works and the widget is able to show the title and playback the audio. However, it does not allow adding multiple tracks to the widget because only the last pair is recognized.

I guess that in order to comply with the docs, the PreviewWidget's add_attribute_value method of the bindings should be checking for a variant of type array (line #89 of preview-widget.cc) and handle it instead of checking for a dict, as it currently stands.