当前位置: 首页>>代码示例>>Java>>正文


Java Manager.getSupportedContentTypes方法代码示例

本文整理汇总了Java中javax.microedition.media.Manager.getSupportedContentTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Manager.getSupportedContentTypes方法的具体用法?Java Manager.getSupportedContentTypes怎么用?Java Manager.getSupportedContentTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.microedition.media.Manager的用法示例。


在下文中一共展示了Manager.getSupportedContentTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MediaRecorder

import javax.microedition.media.Manager; //导入方法依赖的package包/类
public MediaRecorder(String path) throws IOException {
    try {
        String [] supportedContentType = Manager.getSupportedContentTypes("capture");
        boolean amrSupported = false;
        for (int i = 0; i < supportedContentType.length; i++) {
            if(supportedContentType[i].equals("audio/amr")){
                amrSupported = true;
            }
        }
        if(amrSupported){
            try {
                //some j2me devices will report they supports amr, but they are actually 
                //don't so we will try to realize the player and if fails the
                //fallback would be to create it with the default capture encoding
                recorder = Manager.createPlayer("capture://audio?encoding=audio/amr");                                
                recorder.realize();
            } catch (Exception e) {
                recorder = Manager.createPlayer("capture://audio");
                recorder.realize();
            }
        }else{
            recorder = Manager.createPlayer("capture://audio");
            recorder.realize();
        }
        rc = (RecordControl) recorder.getControl("RecordControl");
        out = FileSystemStorage.getInstance().openOutputStream(path);
        rc.setRecordStream(out);
    } catch (MediaException ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:32,代码来源:MediaRecorder.java

示例2: addCameraViewer

import javax.microedition.media.Manager; //导入方法依赖的package包/类
private void addCameraViewer() throws MediaException, IOException {
    String refForCamera = "";
    //#if polish.identifier.motorola/v3xx
    refForCamera = "capture://camera";
    //#elif polish.group.series60e3
    refForCamera = "capture://devcam0";
    //#else
    refForCamera = "capture://video";
    //#endif

    String[] contentTypes = Manager.getSupportedContentTypes("capture");
    if (contentTypes == null || contentTypes.length == 0) {
        throw new MediaException("capture not supported");
    }

    for (int i = 0; i < contentTypes.length; i++) {
        String contentType = contentTypes[i];

        if ("image".equals(contentType)) { // this is the case on Series 40,
            // for example
            refForCamera = "capture://image";
        }
    }

    System.out.println("Starting player");
    player = Manager.createPlayer(refForCamera);
    player.realize();
    videoControl = (VideoControl) player.getControl("VideoControl");

    videoItem = (javax.microedition.lcdui.Item) videoControl
            .initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, null);
    showVideoScreen();

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:35,代码来源:ImageCaptureScreen.java

示例3: isMediaSupported

import javax.microedition.media.Manager; //导入方法依赖的package包/类
/**
 * Returns boolean indication is media mimetype supported by the Device.
 * 
 * @param mimeType
 *            String as media mime-type
 * @return boolean is supported
 */
public boolean isMediaSupported(String mimeType) {
    String[] types = Manager.getSupportedContentTypes(null);
    for (int i = 0; i < types.length; i++) {
        if (mimeType.toLowerCase().equals(types[i].toLowerCase())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:17,代码来源:PlayerPool.java

示例4: init

import javax.microedition.media.Manager; //导入方法依赖的package包/类
private void init() {
    String apiVersion = System.getProperty("microedition.media.version");
    append("MM API version:" + apiVersion + "\n");
    append("Mixing supported: " + System.getProperty("supports.mixing") + "\n");
    append("Audio capture supported: " + System.getProperty("supports.audio.capture") + "\n");
    append("Video capture supported: " + System.getProperty("supports.video.capture") + "\n");
    append("Recording supported: " + System.getProperty("supports.recording") + "\n");
    append("Supported audio encodings: " + System.getProperty("audio.encodings") + "\n");
    append("Supported video encodings: " + System.getProperty("video.encodings") + "\n");
    append("Supported video snaphot encodings: " + System.getProperty("video.snapshot.encodings") + "\n");
    append("\n");
    String streamable = System.getProperty("streamable.contents");
    if (streamable == null) {
        append("Streaming: not supported.\n");
    } else {
        append("Streamable contents: " + streamable);
        String[] rtp = Manager.getSupportedContentTypes("rtp");
        if (rtp != null && rtp.length > 0) {
            append("RTP protocol supported.");
        }
        String rtsp[] = Manager.getSupportedContentTypes("rtsp");
        if (rtsp != null && rtsp.length > 0) {
            append("RTSP protocol supported.");
        }
    }
    String[] contentTypes = Manager.getSupportedContentTypes(null);
    if (contentTypes != null) {
        append("\n\nAll supported content types:\n");
        for (int i = 0; i < contentTypes.length; i++) {
            append(contentTypes[i] + "\n");
        }
    }
}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:34,代码来源:SupportForm.java


注:本文中的javax.microedition.media.Manager.getSupportedContentTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。