如何在J2ME中使用platformRequest(URL)在视频播放器中播放视频

时间:2014-03-14 06:24:57

标签: java-me video-player nativeapplication

在我的应用中,我尝试使用platformRequest(URL)从SD卡播放视频。这是我以前用来做的代码 - platformRequest(" file:/// E:/bega.3gp")。我不知道这是正确的做法。路径格式是否正确?请建议我从我的应用程序中播放视频播放器中的视频。

1 个答案:

答案 0 :(得分:1)

确保传递正确的路径。使用下面的代码,您将能够知道哪些是可用的路径。

 private String getFullMusicPath() {
    Enumeration drives = FileSystemRegistry.listRoots();
    String root = null;
    while (drives.hasMoreElements()) {
        root = (String) drives.nextElement();
        if (root.equalsIgnoreCase("sdcard/")) {
            return "file:///" + root + musicFolder + "/";
        }
    }
    return (root == null ? null : "file:///" + root + musicFolder + "/");
}
相关问题