游戏采用USB连接,通过OTG线视频在Android的? [英] Play Video using connected USB via OTG cable in Android?
本文介绍了游戏采用USB连接,通过OTG线视频在Android的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想问一下,有其中用户可以连接USB通过OTG线设备到Android和发挥它包含媒体(特别是视频),可用的应用程序。
I want to ask that there are application available in which user can connect USB to Android via OTG cable device and play the media (specially videos) contained by it.
我已经做了广播接收器检测到连接的USB,我想也可以参考的内容。我用这code段。
i have made a Broadcast Receiver to detect the attached USB, i want to read the content also. I am using this code snippet.
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) {
synchronized (this) {
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if(device != null){
//
Log.d("1","DEATTCHED-" + device);
}
}
}
//
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
synchronized (this) {
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if(device != null){
//
Log.d("1","ATTACHED-" + device);
}
}
else {
PendingIntent mPermissionIntent;
mPermissionIntent = PendingIntent.getBroadcast(MainActivity.this, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_ONE_SHOT);
mUsbManager.requestPermission(device, mPermissionIntent);
}
}
}
//
if (ACTION_USB_PERMISSION.equals(action)) {
synchronized (this) {
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if(device != null){
//
Log.d("1","PERMISSION-" + device);
}
}
}
}
}
};
我想提出这样一种应用。
I want to make such kind of application.
做任何有关于一些想法?
Do anyone have some idea about that?
推荐答案
经过多日研究,我已经找到了解决办法
After researches of many days i have found the solution
https://github.com/1hakr/AnExplorer
这篇关于游戏采用USB连接,通过OTG线视频在Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文