Before you go, check out these stories!

0
Hackernoon logoBuilding a Free Music Site Using React Native by@Hayes

Building a Free Music Site Using React Native

Author profile picture

@HayesAlex

Until 10 years he lived in Ukraine, but his parents moved to Canada.

So, you want to build a music site with React Native. That’s not an ordinary task because of certain technical limitations but it’s still possible. The chosen framework works best for mobile applications so you can get two or even three products instead of one: a music website and mobile apps for iOS and Android. Sounds good, huh? The question is how to develop such solutions, and we’re going to answer it in this guide.

Firstly, let’s agree to not touch complex tech things. You won’t find code snippets here. Instead, you can focus on planning and strategies, learn about music platforms, React Native fundamentals, and the best approaches to development. As it’s clear, let’s start!

A Word About Music Distribution

Audio content is diverse, and so is music software. There are streaming apps like Spotify, royalty-free libraries like TakeTones, online radio stations, media players, mixers, music-making tools. Your first target on the road to own site is to decide what’re you building actually. What are the product’s goals? How it tailors to the user needs? Which features it should have?

  • Coming to audio usage cases, we can define a few options:
  • Interactive sounds.
  • Notifications.
  • Recorded sounds.
  • Streaming.
  • Voice-over.

You can see these points in the chart above. Based on them, you can define which area is the most critical for your ideal music site. Usually, web platforms rely on huge databases with audio. Web apps enable recording, voice-over, and interactive usage. And mobile solutions often focus on streaming and notifications.

It’s up to you which section or sections to choose but remember not to overload the solution with features. We suggest choosing one or two core aspects and work out them properly. Take Spotify that relies on streaming. This service is insanely popular yet pretty simple. Based on the areas, you can choose features and plan the development itself.

React Native 101

React Native is a mobile app framework that enhances React development. Both projects are based on JavaScript and designed by Facebook. According to the name, React Native suits native development of various app interfaces, including solutions for web, iOS, Android, as well as cross-platform projects. It also supports native coding on Java for Android and Swift/Objective-C for iOS. Underlying principles are almost the same as ones in React.

As you should understand by now, React Native is widely used for app development. Software engineers appreciate its core features:

  • Has a live reload. This feature activates two screens: for coding and checking.
  • Praises UI. The framework is responsive and renders quickly, boosting UI.
  • Provides good performance. It’s GPU-oriented so it works better than CPU analogs.
  • Supports third-party tools. You can add external libraries freely.
  • Trusted by users. It’s developed by Facebook and has a great community.
  • Uses JavaScript. What’s important, it’s one of the core web languages.
  • Works on all platforms. You can write code once and run it on many systems.

Simultaneously, this framework can be also used for web development. Further, we will return to this question.

React Native Audio Libraries

Now, let’s move to tech basics of React Native development. After choosing the niche for your music platform and deciding on key features, the main step is to select libraries. These repositories come with many premade UI components. Thus, you can save tons of time by taking appropriate elements and putting them into your software.

Remember our chart with music services? Look at the same chart but with React Native libraries for audio content. Here, the horizontal axis defines how your app will interact with audio files (use local files or get them on-demand). The vertical axis reflects the reproduction method. Big podcasts are usually streamed while small sounds can be loaded at once.

Source: Emmett Harper

Check the chart, choose your quadrant, and then use the appropriate libraries. You aren’t limited to these ones, feel free to look for other components from React Native. For your info, here are some basics:

React-native-audio. Mainly, used for recording. Can be helpful if you need this feature in your applications or on the website.

React-native-audio-toolkit. Has Android background audio, basic controls, recording, and local + network storage. Still, it can’t stream audio.

React-native-music-control. Provides media control features for other libraries that don’t have them initially. 

React-native-sound. Stores files locally and can access network, doesn’t record or stream music, supports iOS background.

React-native-track-player. Supports background for all platforms, has extensive controls, can stream and cast, integrates through API.

React-native-video. Focuses on video, evidently, but also can work with music. Has audio-only preferences.

Apart from libraries, you may need extra functionality. It’s barely possible to describe all the dev approaches so let’s look at a few fundamentals.

From Apps to Websites

After adding and tuning the chosen library, you should focus on product-specific features. For instance, audio players require media controls while online music databases need search and filter tools. It’s up to you which approach to choose. For more real-world examples, we suggest checking step-by-step guides. For instance, here’s one with a Spotify-like test case. And here’s the story of Finimize development.

And here’s the main question: is it ever possible to use React Native for the web? Although the framework focuses on mobile development, it can be paired with traditional React. Unfortunately, these tools use different primitives. To connect two frameworks, you can use the project called React Native for Web. Put simply, it provides browser versions of React Native components, as well as CSS styles.  

Overall, the solution is pretty useful for web devs who want to use React Native.

Final Thoughts

Let’s be honest, React Native for web development isn’t the most straightforward choice. There are many tools with richer functionality and/or more familiar principles. However, React Native is great for music apps because it allows you to build cross-platform products. Thanks to various libraries, developers can use ready components and save time. If you’re going to develop a music application, consider this framework.

Author profile picture

@HayesAlex

Read my stories

Until 10 years he lived in Ukraine, but his parents moved to Canada.

Tags

Become a Hackolyte

Level up your reading game by joining Hacker Noon now!