/** Create a media locator from the given string. */ @SuppressWarnings("unused") static MediaLocator createMediaLocator(String url) { MediaLocator ml; if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null) { return ml; } if (url.startsWith(File.separator)) { if ((ml = new MediaLocator("file:" + url)) != null) { return ml; } } else { String file = "file:" + System.getProperty("user.dir") + File.separator + url; if ((ml = new MediaLocator(file)) != null) { return ml; } } return null; }
public void chooseFile() { if (!h4JmfPlugin.jmf_ok) return; if (h4JmfPlugin.playMP3 != null) { h4JmfPlugin.cnsl.append("playMP3!=null"); return; } String tmpdir = System.getProperty("java.io.tmpdir"); String[] paths = GUIUtilities.showVFSFileDialog( view, tmpdir + File.separator, JFileChooser.OPEN_DIALOG, false); // if(paths!=null && !paths[0].equals(filename)) if (paths != null) { String filename = paths[0]; h4JmfPlugin.cnsl.append("filename=" + filename); try { URL url = new URL("file://" + filename); player_begin(url); } catch (Exception e) { logger.severe(e.getMessage()); h4JmfPlugin.cnsl.append(e); } } } // chooseFile