1 /*
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
40 public class MediaManager {
41
42 private MediaManager() {
43 // prevent instantiation of this class
44 }
45
46 /**
47 * @return {@link String} array of supported content types.
48 */
49 public static String[] getSupportedContentTypes() {
50 return NativeMediaManager.getDefaultInstance().getSupportedContentTypes();
51 }
52
53 /**
54 * Whether a media source having the indicated content type may be
55 * played.
56 *
57 * @throws IllegalArgumentException if <code>contentType</code> is
58 * <code>null</code>.
59 */
60 public static boolean canPlayContentType (String contentType) {
61 if (contentType == null) {
62 throw new IllegalArgumentException("contentType == null!");
63 }
64 return NativeMediaManager.getDefaultInstance().canPlayContentType (contentType);
65 }
66
67
68 // XXX javadoc
69 public static MetadataParser getMetadataParser(Locator locator) {
70 if (locator == null) {
71 throw new IllegalArgumentException("locator == null!");
72 }
73 return NativeMediaManager.getDefaultInstance().getMetadataParser(locator);
74 }
75
76 /**
77 * Gets a Media object for the clip. It cannot be played without attaching
78 * to a MediaPlayer.
79 *
80 * @param locator
81 * @return Media object
82 * @throws IllegalArgumentException if <code>locator</code> is
83 * <code>null</code>.
84 */
|
1 /*
2 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
40 public class MediaManager {
41
42 private MediaManager() {
43 // prevent instantiation of this class
44 }
45
46 /**
47 * @return {@link String} array of supported content types.
48 */
49 public static String[] getSupportedContentTypes() {
50 return NativeMediaManager.getDefaultInstance().getSupportedContentTypes();
51 }
52
53 /**
54 * Whether a media source having the indicated content type may be
55 * played.
56 *
57 * @throws IllegalArgumentException if <code>contentType</code> is
58 * <code>null</code>.
59 */
60 public static boolean canPlayContentType(String contentType) {
61 if (contentType == null) {
62 throw new IllegalArgumentException("contentType == null!");
63 }
64 return NativeMediaManager.getDefaultInstance().canPlayContentType(contentType);
65 }
66
67 /**
68 * Whether a media source having the indicated protocol may be
69 * played.
70 *
71 * @throws IllegalArgumentException if <code>contentType</code> is
72 * <code>null</code>.
73 */
74 public static boolean canPlayProtocol(String protocol) {
75 if (protocol == null) {
76 throw new IllegalArgumentException("protocol == null!");
77 }
78 return NativeMediaManager.getDefaultInstance().canPlayProtocol(protocol);
79 }
80
81
82 // XXX javadoc
83 public static MetadataParser getMetadataParser(Locator locator) {
84 if (locator == null) {
85 throw new IllegalArgumentException("locator == null!");
86 }
87 return NativeMediaManager.getDefaultInstance().getMetadataParser(locator);
88 }
89
90 /**
91 * Gets a Media object for the clip. It cannot be played without attaching
92 * to a MediaPlayer.
93 *
94 * @param locator
95 * @return Media object
96 * @throws IllegalArgumentException if <code>locator</code> is
97 * <code>null</code>.
98 */
|