Skip to content

Commit fe581ff

Browse files
committed
put supported network protocols in static array
1 parent 12293d7 commit fe581ff

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

  • java/libraries/video/src/processing/video

java/libraries/video/src/processing/video/Movie.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
* @usage application
5353
*/
5454
public class Movie extends PImage implements PConstants {
55+
public static String[] supportedProtocols = { "http" };
56+
5557
protected String filename;
5658

5759
protected boolean playing = false;
@@ -681,18 +683,21 @@ protected void initGStreamer(PApplet parent, String filename) {
681683
e.printStackTrace();
682684
}
683685
}
684-
685-
// Network read...
686-
if (gplayer == null && filename.startsWith("http://")) {
687-
try {
688-
PApplet.println("network read");
689-
gplayer = new PlayBin2("Movie Player");
690-
gplayer.setURI(URI.create(filename));
691-
} catch (Exception e) {
692-
e.printStackTrace();
693-
}
694-
}
695-
686+
687+
if (gplayer == null) {
688+
// Try network read...
689+
for (int i = 0; i < supportedProtocols.length; i++) {
690+
if (filename.startsWith(supportedProtocols[i] + "://")) {
691+
try {
692+
gplayer = new PlayBin2("Movie Player");
693+
gplayer.setURI(URI.create(filename));
694+
break;
695+
} catch (Exception e) {
696+
e.printStackTrace();
697+
}
698+
}
699+
}
700+
}
696701
} catch (SecurityException se) {
697702
// online, whups. catch the security exception out here rather than
698703
// doing it three times (or whatever) for each of the cases above.

0 commit comments

Comments
 (0)