Giter Site home page Giter Site logo

bmmutexaudiomanager's Introduction

BMMutexAudioManager

Feature

image

Installation

Simply copy "BMMutexAudioManager" floder to your project.

Getting Started

Use by including the following import:

#import "BMMutexAudioManager.h"

In ViewController, you need to adopt these protocols:

@interface ViewController () <UITableViewDelegate, UITableViewDataSource, BMMutexAudioManagerDelegate>

And then implement the methods in the protocol:

- (void)mutexAudioManagerPlayingCell:(NSIndexPath *)playingCellIndexPath
                            progress:(CGFloat)progress
                            duration:(NSInteger)duration {
    //update current playing cell's UI in this method.
}

- (void)mutexAudioManagerDidChanged:(NSIndexPath *)changedIndexPath statusModel:(BMMutexAudioStatusModel *)statusModel {
    //update last playing cell and current playing cell in this method.
}

In UITableViewDataSource,method "tableView:cellForRowAtIndexPath:", you need to get the StatusModel and update cell to its initial state. And give the slider's value to manager. For example:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BMAudioPlayerDemoCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

    BMMutexAudioStatusModel *statusModel =
    [[BMMutexAudioManager sharedInstance] queryStatusModelWithIndexPath:indexPath
                                                               audioURL:[self generateAudioURLWithIndexPath:indexPath]];
    if (statusModel) {
        [cell changeButtonImageWithPlayerStatus:statusModel.currentStatus];
        [cell changeProgressLabelWithCurrentSecond:statusModel.currentProgress * statusModel.duration duration:statusModel.duration];
    } else {
        [cell changeButtonImageWithPlayerStatus:EBMPlayerStatusStop];
    }
    [cell changeSliderPositionWithProgress:statusModel.currentProgress];

    cell.controlButtonClickBlock = ^() {
        [[BMMutexAudioManager sharedInstance] clickPlayButtonWithAudioURL:[self generateAudioURLWithIndexPath:indexPath]
                                                            cellIndexPath:indexPath];
    };

    cell.returnSliderValueBlock = ^(float value) {
        [[BMMutexAudioManager sharedInstance] setPlayerProgressByProgress:value cellIndexPath:indexPath];
    };
    return cell;
}

Communication

  • If you need help, or if you'd like to ask a general question, please contact me. Email: [email protected]
  • If you found a bug, and can provide steps to reliably reproduce it, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.

bmmutexaudiomanager's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.