All Projects → ShawnFoo → FXDanmaku

ShawnFoo / FXDanmaku

Licence: MIT license
High-performance danmaku with click event, reusable items and customize configurations.

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to FXDanmaku

Pakku.js
拯救B站的弹幕体验!
Stars: ✭ 1,182 (+1519.18%)
Mutual labels:  danmaku
Bilibili Downloader
哔哩哔哩视频下载器 | Yet another video downloader for Bilibili
Stars: ✭ 146 (+100%)
Mutual labels:  danmaku
Barragerenderer
一个 iOS 上的弹幕渲染库.
Stars: ✭ 2,084 (+2754.79%)
Mutual labels:  danmaku
Animesearcher
整合第三方网站的视频和弹幕资源, 为白嫖党提供最佳看番追剧体验
Stars: ✭ 101 (+38.36%)
Mutual labels:  danmaku
Dplayer
🍭 Wow, such a lovely HTML5 danmaku video player
Stars: ✭ 12,101 (+16476.71%)
Mutual labels:  danmaku
Us Danmaku
Firefox 扩展版本见 https://github.com/tiansh/ass-danmaku ;【用户脚本已停止维护】用户脚本 以ass格式下载 AcFun 和 bilibili 的弹幕
Stars: ✭ 158 (+116.44%)
Mutual labels:  danmaku
Yatto
Parse & play online video with danmaku on local player.
Stars: ✭ 14 (-80.82%)
Mutual labels:  danmaku
Saccubus1
さきゅばす1系のリポジトリです
Stars: ✭ 49 (-32.88%)
Mutual labels:  danmaku
Bilibili Ban List
居家旅行常备的B站弹幕屏蔽列表
Stars: ✭ 143 (+95.89%)
Mutual labels:  danmaku
Niconvert
弹幕转换工具
Stars: ✭ 171 (+134.25%)
Mutual labels:  danmaku
Qliveplayer
A cute and useful Live Stream Player with danmaku support.
Stars: ✭ 105 (+43.84%)
Mutual labels:  danmaku
Commentcorelibrary
Javascript Live Comment (Danmaku) Engine Implementation. JS弹幕模块核心,提供从基本骨架到高级弹幕的支持。
Stars: ✭ 1,724 (+2261.64%)
Mutual labels:  danmaku
Danmaku
An open source Danmaku development kit for Unity3D.
Stars: ✭ 163 (+123.29%)
Mutual labels:  danmaku
Danmu.server
一个开源的弹幕后端
Stars: ✭ 92 (+26.03%)
Mutual labels:  danmaku
Blivedm
获取bilibili直播弹幕,使用websocket协议
Stars: ✭ 230 (+215.07%)
Mutual labels:  danmaku
Danmaku
live video comments protocol and platform api
Stars: ✭ 70 (-4.11%)
Mutual labels:  danmaku
Danmu Client
A cross-platforms danmaku client that supports transparency which based on canvas + WebSocket. 多用跨平台透明弹幕客户端,支持图文弹幕,基于canvas + WebSocket。
Stars: ✭ 151 (+106.85%)
Mutual labels:  danmaku
acfundanmu
AcFun直播API
Stars: ✭ 27 (-63.01%)
Mutual labels:  danmaku
teki
Touhou-style shoot'em up
Stars: ✭ 60 (-17.81%)
Mutual labels:  danmaku
Danmu Server
A danmaku server based on WebSocket. 弹幕服务器,基于WebSocket。
Stars: ✭ 169 (+131.51%)
Mutual labels:  danmaku

FXDanmaku

中文 iOS 7.0+ pod compatible License

High-performance danmaku with click event, reusable items and customize configurations.

Features

  1. Except UI operations in main-thread, other operations are in different dispatch queues.
  2. Followed producer-cosumer pattern with pthread lib.
  3. Defined delegate protocol to handle click response or other events.
  4. Methods to register resuable item. Defined FXDanmakuItem class to custom your own item by inheriting it.
  5. Many configurations to meet your product's requirements. Such as, the velocity of item, the order to insert item, the direction of item movement and so on.
  6. Easy to use. Just three control: start(resume), pause, stop. Except that, most methods are thread-safe.
  7. Adaptation to the change of device orientaion.

Preview

Example

Setup danmaku view:

// Configuration
FXDanmakuConfiguration *config = [FXDanmakuConfiguration defaultConfiguration];
config.rowHeight = [DemoDanmakuItem itemHeight];
config.dataQueueCapacity = 500;
config.itemMinVelocity = 80;  // set random velocity between 80 and 120 pt/s
config.itemMaxVelocity = 120;
self.danmaku.configuration = config;

// Delegate
self.danmaku.delegate = self;

// Reuse
[self.danmaku registerNib:[UINib nibWithNibName:NSStringFromClass([DemoDanmakuItem class]) bundle:nil]
   forItemReuseIdentifier:[DemoDanmakuItem reuseIdentifier]];
[self.danmaku registerClass:[DemoBulletinItem class]
     forItemReuseIdentifier:[DemoBulletinItem reuseIdentifier]];

Add data:

// add data for danmaku view to present
DemoDanmakuItemData *data = [DemoDanmakuItemData data];
[self.danmaku addData:data];

// start running
if (!self.danmaku.isRunning) {
    [self.danmaku start];
}

Handle click in delegate method:

- (void)danmaku:(FXDanmaku *)danmaku didClickItem:(FXDanmakuItem *)item withData:(DemoDanmakuItemData *)data {
    // handle click event here
}

More examples in FXDanmakuDemo.xcworkspace.

Demo build succeed in Xcode8.

Q&A

1. Relationships among rowHeight、estimatedRowSpace and rowSpace.

2. How to create your danmakuItem by nib.

Last thing, drag IBOutlet property to setup your custom danmakuItem.

3. Adaptation to the change of device orientaion.

Only when your danmaku view's height will change in different device orientaion, should you do a little work to adapt. Otherwise, you won't need to add any codes. Let's say, your danmaku view's height is 100pt in portrait, but is 200pt in lanscape. Then add codes below in your controller.

For iOS8 And Later

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
    [self.danmaku pause];
    [self.danmaku cleanScreen];

    [coordinator animateAlongsideTransition:nil
								 completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
                                 	// resume danmaku after orientation did change
                                 	[self.danmaku start];
                             	 }];
}

For version lower than iOS8

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    [self.danmaku pause];
    [self.danmaku cleanScreen];
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    [self.danmaku start];
}

4. How to limit the capacity of the data queue to the FXDanmaku view?

// By setting the FXDanmakuConfiguration
FXDanmakuConfiguration *config = [FXDanmakuConfiguration defaultConfiguration];
// The number of FXDanmakuItemData that FXDanmaku view can hold at maximum count.
config.dataQueueCapacity = 500;
// Beyond this value, the data will be discarded.

In addition, you still have chance to decide which data can be added into the queue when data quque is full through delegate method.

- (BOOL)shouldAddDanmakuItemDataWhenQueueIsFull:(FXDanmakuItemData *)data {
    // Keep adding data with high priority, even the number of the data in queue reaches maximum count
    return FXDataPriorityHigh == data.priority;
}

Requirements

FXDanmaku requires iOS 7.0+.

Installation

Cocoapods(iOS7+)

  1. Add these lines below to your Podfile

    platform :ios, 'xxx'
    target 'xxx' do
      pod 'FXDanmaku', '~> 1.0.0'
    end
    
  2. Install the pod by running pod install

Manually(iOS7+)

Drag FXDanmaku document to your project

License

FXDanmaku is provided under the MIT license. See LICENSE file 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].