All Projects → yujinakayama → Nakplaybackindicatorview

yujinakayama / Nakplaybackindicatorview

Licence: mit
A UIView that mimics the music playback indicator in the Music.app on iOS 7+

Projects that are alternatives of or similar to Nakplaybackindicatorview

Nighthawk
A stealthy, simple, unobtrusive music player that stays out of your way
Stars: ✭ 197 (-50%)
Mutual labels:  music, player
Pathephone Desktop
Distributed audio player
Stars: ✭ 240 (-39.09%)
Mutual labels:  music, player
Imusic
一个集视频播放器、音乐播放器封装库于一身的iMusic工程
Stars: ✭ 228 (-42.13%)
Mutual labels:  music, player
Playpauseview
Let the play and pause button transition gracefully
Stars: ✭ 383 (-2.79%)
Mutual labels:  music, player
Upnext
Chrome Extension for streaming music from SoundCloud & YouTube
Stars: ✭ 320 (-18.78%)
Mutual labels:  music, player
Otter
Music player for Funkwhale
Stars: ✭ 177 (-55.08%)
Mutual labels:  music, player
Ytermplayer
Stream youtube playlists as audio on linux terminal
Stars: ✭ 235 (-40.36%)
Mutual labels:  music, player
Pragha
Pragha is a Lightweight Music Player for GNU/Linux.
Stars: ✭ 136 (-65.48%)
Mutual labels:  music, player
Simple Music Player
Simple Music Player - SimpleMP - Keeps it simple and plays your music
Stars: ✭ 298 (-24.37%)
Mutual labels:  music, player
Openwhyd
💎 Like Pinterest, for Music
Stars: ✭ 287 (-27.16%)
Mutual labels:  music, player
Html Midi Player
🎹 Play and display MIDI files on the web
Stars: ✭ 158 (-59.9%)
Mutual labels:  music, player
React Music Player
🎵 Maybe the best beautiful HTML5 responsive player component for react :)
Stars: ✭ 321 (-18.53%)
Mutual labels:  music, player
Odyssey
Odyssey music player
Stars: ✭ 153 (-61.17%)
Mutual labels:  music, player
Fradioplayer
A simple radio player framework for iOS, macOS, tvOS.
Stars: ✭ 183 (-53.55%)
Mutual labels:  music, player
Musicplayer
A minimal music player built on electron.
Stars: ✭ 145 (-63.2%)
Mutual labels:  music, player
Swift Radio Pro
Professional Radio Station App for iOS!
Stars: ✭ 2,644 (+571.07%)
Mutual labels:  music, player
Sbplayerclient
支持全格式的mac版视频播放器
Stars: ✭ 110 (-72.08%)
Mutual labels:  music, player
Shuffle
Shuffle every song in existence from YouTube
Stars: ✭ 131 (-66.75%)
Mutual labels:  music, player
Feeluown
trying to be a user-friendly and hackable music player
Stars: ✭ 3,030 (+669.04%)
Mutual labels:  music, player
Vinylmusicplayer
A material designed music player for Android
Stars: ✭ 323 (-18.02%)
Mutual labels:  music, player

Version Build Status

Icon NAKPlaybackIndicatorView

Music.app

NAKPlaybackIndicatorView is a view that mimics the music playback indicator in the Music.app on iOS. It has some vertical bars and they oscillate randomly.

Requires iOS 8.0 or later.

Trying the Demo App

You can try the demo app instantly with CocoaPods:

# This will open an Xcode workspace
$ pod try NAKPlaybackIndicatorView

In the opened workspace, choose the Demo scheme and run.

Installation

NAKPlaybackIndicatorView is available through CocoaPods, to install it simply add the following line to your Podfile:

pod 'NAKPlaybackIndicatorView'

Then run pod install.

Basic Usage

Here's a basic example:

#import <NAKPlaybackIndicatorView/NAKPlaybackIndicatorView.h>

- (void)viewDidLoad
{
    [super viewDidLoad];

    NAKPlaybackIndicatorViewStyle *style = [NAKPlaybackIndicatorViewStyle iOS7Style];
    NAKPlaybackIndicatorView *indicator = [[NAKPlaybackIndicatorView alloc] initWithStyle:style];
    [self.view addSubview:indicator];
    [indicator sizeToFit];

    // Initially the `state` property is NAKPlaybackIndicatorViewStateStopped
    // and the `hidesWhenStopped` property is YES.
    // Thus, the view is hidden at this time.

    // The view appears and the bars start animation.
    indicator.state = NAKPlaybackIndicatorViewStatePlaying;

    // The bars stop animation and become idle.
    indicator.state = NAKPlaybackIndicatorViewStatePaused;

    // The view becomes hidden.
    indicator.state = NAKPlaybackIndicatorViewStateStopped;
}

You can use NAKPlaybackIndicatorView in both code and Storyboard, and it works well with both Auto Layout and frame-based layout.

Code with Auto Layout

NAKPlaybackIndicatorView *indicator = [[NAKPlaybackIndicatorView alloc] initWithFrame:CGRectZero];
indicator.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:indicator];

// Then, add some positioning layout constraints.
// Note that normally you don't need to add sizing constraints
// since NAKPlaybackIndicatorView has an intrinsic content size.
// It will be automatically resized to fit its content.

Code with Frame-Based Layout

NAKPlaybackIndicatorView *indicator = [[NAKPlaybackIndicatorView alloc] initWithFrame:CGRectZero];
[self.view addSubview:indicator];
[indicator sizeToFit]; // Resize itself to fit its content.

Storyboard with Auto Layout

  1. Put a UIView on your view.
  2. Set its custom class to NAKPlaybackIndicatorView.
  3. In the Size Inspector (⌥⌘5), set the Intrinsic Size to Placeholder and set the width to 12 and the height to 12. Note that this is just for convenience of the appearance on the Storyboard, and the placeholder size won't be used at runtime.
  4. Add some positioning layout constraints.

Storyboard with Frame-Based Layout

  1. Put a UIView on your view.
  2. Set its custom class to NAKPlaybackIndicatorView.
  3. In the Size Inspector (⌥⌘5), set the width to 12 and the height to 12.

Customization

Bar Count, Size, and Spacing

Bars can be customized via NAKPlaybackIndicatorViewStyle.

Color

The color of the bars can be changed by setting tintColor property (UIView) of the view or its ancestor view.

View Size

Normally the view can be automatically resized to fit its content by:

  • Omitting sizing constraints in Auto Layout, since it has an intrinsic content size.
  • Calling sizeToFit in frame-based layout.

Or if you explicitly specify size, the bars will be placed in the center of the view.

Class Reference

NAKPlaybackIndicatorView's class reference is available on CocoaDocs.org.

License

Copyright (c) 2014–2017 Yuji Nakayama

See the LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].