WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章J2ME技术进阶教程熟练使用J2ME在实际开发中的可选包MMAPI

熟练使用J2ME在实际开发中的可选包MMAPI
作者:未知  来源:J2ME开发网  发布时间:2005-7-29 9:21:43
和录音功能的实现


try
{
// Create a DataSource that
captures live audio.
Player p = Manager.createPlayer
("capture://audio");
p.realize();
// Get the RecordControl,
set the record location, and
// start the Player and
record for 5 seconds.
RecordControl rc =
(RecordControl)p.getControl
("RecordControl");
rc.setRecordLocation
("file:/tmp/audio.wav");
rc.startRecord();
p.start();
Thread.currentThread()
.sleep(5000);
p.stop();
rc.stopRecord();
rc.commit();
} catch (IOException ioe)
{
} catch (MediaException me)
{
} catch (InterruptedException e)
{
}




实现摄像功能


Player p;
VideoControl vc;

// initialize camera
try {
p = Manager.createPlayer
("capture://video");
p.realize();

// Grab the video control
and set it to the current
display.
vc = (VideoControl)p.getControl
("VideoControl");
if (vc != null)
{
Form form =
new Form("video");
form.append((Item)vc.initDisplayMode
(vc.USE_GUI_PRIMITIVE, null));
Display.getDisplay(midlet).setCurrent(form);
}

p.start();

} catch (IOException ioe)
{
} catch (MediaException me)
{
}

// now take a picture
try {
byte[] pngImage =
vc.getSnapshot(null);

// do something with the image ...
} catch (MediaException me)
{
}




在后面的文章中我们将通过完整的实例演示如何使用MMAPI开发应用程序。

上一页  [1] [2] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码