Skip to content

How can I use this with Waveform.js? #77

@Twansparant

Description

@Twansparant

Hi there,

I would like to have more control over the waveform styling so I added the Waveform library: http://waveformjs.org/#options

From the examples it seems this only works if you call an SC track with the SoundCloud JS SDK library:

SC.get("/tracks/293", function(track){
  var waveform = new Waveform({
    container: document.getElementById("example2"),
    innerColor: "#333"
  });
  waveform.dataFromSoundCloudTrack(track);
  var streamOptions = waveform.optionsForSyncedStream();
  SC.stream(track.uri, streamOptions, function(stream){
    window.exampleStream = stream;
  });
});

But I was wundering what I should pass as track variable in the waveform.dataFromSoundCloudTrack(track) function so I can use onPlayerInit.scPlayer instead to create the waveform? Something like this:

$('.sc-player').bind('onPlayerInit.scPlayer', function(track){
  $(this).find('.sc-scrubber .sc-time-span .sc-waveform-container').attr('id','sc-waveform');
  var waveform = new Waveform({
    container: document.getElementById('sc-waveform'),
    innerColor: "#333"
  });
  waveform.dataFromSoundCloudTrack(track);
});

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions