控制iphone音乐播放器的相关函数
来源:互联网 发布:js foreach遍历map 编辑:程序博客网 时间:2024/04/30 02:24
https://github.com/rono23/GlovePod
国外牛人的开源工程,其说明如下
You can control music without taking off your gloves!
To use, double-tap home in the lock screen to show the media player.
Then, you can switch to the next/previous track by pressing the increase/decrease volume button.
Additionally, you can play/stop a tune by holding the power button
其中有一些很有用的函数
static BOOL isLocked()
{
return [[objc_getClass("SBAwayController") sharedAwayController] isLocked];
}
static BOOL isDimmed()
{
return [[objc_getClass("SBAwayController") sharedAwayController] isDimmed];
}
static BOOL isVisible()
{
return [[objc_getClass("SBAwayController") sharedAwayController] isShowingMediaControls];
}
static BOOL isPlaying()
{
return [[objc_getClass("SBMediaController") sharedInstance] isPlaying];
}
static BOOL isCalling()
{
return [[objc_getClass("SBTelephonyManager") sharedTelephonyManager] inCall];
}
static BOOL isPowerButtonEnabled()
{
return ((isLocked() && !isCalling()) &&
((LSiPodVisiblePowerButtonEnabled && isVisible()) ||
(LSScreenOnPowerButtonEnabled && !isDimmed() && !isVisible()) ||
(LSScreenOffPowerButtonEnabled && isDimmed())));
}
static BOOL useDefaultVolumeAction(BOOL enabled)
{
return (!isLocked() || (isLocked() && !isPlaying()) || !enabled);
}
/*==============================================================================
==============================================================================*/
static void $SpringBoard$invokeGPPowerButton(SpringBoard *self, SEL sel)
{
invocationGPPowerButtonTimerDidFire = YES;
[[objc_getClass("SBMediaController") sharedInstance] togglePlayPause];
}
static void startInvocationGPPowerButtonTimer()
{
invocationGPPowerButtonTimerDidFire = NO;
SpringBoard *springBoard = (SpringBoard *)[objc_getClass("SpringBoard") sharedApplication];
invocationGPPowerButtonTimer = [[NSTimer scheduledTimerWithTimeInterval:0.7f
target:springBoard selector:@selector(invokeGPPowerButton) userInfo:nil repeats:NO] retain];
}
static void cancelInvocationGPPowerButtonTimer()
{
[invocationGPPowerButtonTimer invalidate];
[invocationGPPowerButtonTimer release];
invocationGPPowerButtonTimer = nil;
}
- 控制iphone音乐播放器的相关函数
- android 音乐、铃声播放控制相关问题
- 系统音乐播放器暂停、播放的控制
- iOS音乐播放器的后台播放和远程控制
- QQ音乐远程控制,旧iPhone连音响当播放器,另一个手机远程控制
- 音乐播放器 Songbird 相关
- 控制音乐播放器的退出再次播放相同音乐的功能实现
- 控制iphone中的实体按钮和音乐播放
- Android音乐播放器---实现Notification控制音乐播放
- Android音乐播放器---实现Notification控制音乐播放
- Android音乐播放器---实现Notification控制音乐播放
- Android音乐播放器---实现Notification控制音乐播放
- iphone 音乐播放
- iPhone播放音乐
- TipSkip:以敲击方式控制播放器的音乐应用
- android音乐播放器的音频焦点控制
- android音乐播放器的音频焦点控制
- android音乐播放器的音频焦点控制
- SNMP trap
- qt 语言切换学习心得
- JS表单提交验证类
- CI框架如何删除地址栏的 index.php
- 有图片预览功能的上传表单
- 控制iphone音乐播放器的相关函数
- include与jsp:include区别
- 求救
- SNMP协议(轮训和中断检测)
- java的几种对象(PO,VO,DAO,BO,POJO)解释
- Android开发自动提示框
- 111
- C#调用OCX控件Catastrophic failure解决方法
- 代理上网帐号的筛选程序