javascripthtmlflutterdartsoundcloud

How to use html, javascript code in flutter mobile platforms?


I've been using Flutter for about 4 months now, but I do not have any experience in Javascript. I want to use the Soundcloud HTTP API and build an app with it. But I'm stuck with using JS in Flutter. I'm trying to make an user-interactive app that requires these features,

  1. Search music on Soundcloud. => The user gets to choose a song on Soundcloud.

  2. Post the selected music on a feed. => Then the selected song gets posted on the feed page as a music player-like Widget.

  3. Let other users play the music when it shows up on their feed. => The music player then can be seen by others with additional description and etc.

To wrap up, I'm trying to make a Soundcloud clone that can actually use Soundcloud source using Flutter but I do not know what to do since Soundcloud only provides API for Ruby, Python, and JS.

For example, I don't know how to implement the following JS code, an example code in the api document, which creates an embedded Soundcloud player.

<script src="https://connect.soundcloud.com/sdk/sdk-3.3.2.js"></script>
<script>
SC.initialize({
  client_id: 'YOUR_CLIENT_ID'
});

var track_url = 'https://soundcloud.com/forss/flickermood';
SC.oEmbed(track_url, { auto_play: true }).then(function(oEmbed) {
  console.log('oEmbed response: ', oEmbed);
});
</script>

I found out that using HTML and JS in Flutter web is possible, but I'm not sure if it works on mobile platforms also.

I hope to get some feedbacks from the experts in JS and Dart. Thank you.


Solution

  • You can use flutter_js. You can try it once.