1.Get the CaptureDeviceInfo object for the camera.
2.Create a Player using the MediaLocator retrieved from the CaptureDeviceInfo object. (You can create the Player by calling createPlayer(MediaLocator) or create a DataSource with the MediaLocator and use createPlayer(DataSource) to construct the Player.)
以抓取音频为例:
// Get the CaptureDeviceInfo for the live audio capture device
Vector deviceList = CaptureDeviceManager.getDeviceList(new
AudioFormat("linear", 44100, 16, 2));
if (deviceList.size() > 0)
di = (CaptureDeviceInfo)deviceList.firstElement();
else
// Exit if we can't find a device that does linear, 44100Hz, 16 bit,
// stereo audio.
System.exit(-1);
// Create a Player for the capture device:
try{
Player p = Manager.createPlayer(di.getLocator());
} catch (IOException e) {
} catch (NoPlayerException e) {}
2.Create a Player using the MediaLocator retrieved from the CaptureDeviceInfo object. (You can create the Player by calling createPlayer(MediaLocator) or create a DataSource with the MediaLocator and use createPlayer(DataSource) to construct the Player.)
以抓取音频为例:
// Get the CaptureDeviceInfo for the live audio capture device
Vector deviceList = CaptureDeviceManager.getDeviceList(new
AudioFormat("linear", 44100, 16, 2));
if (deviceList.size() > 0)
di = (CaptureDeviceInfo)deviceList.firstElement();
else
// Exit if we can't find a device that does linear, 44100Hz, 16 bit,
// stereo audio.
System.exit(-1);
// Create a Player for the capture device:
try{
Player p = Manager.createPlayer(di.getLocator());
} catch (IOException e) {
} catch (NoPlayerException e) {}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货