Biblioteca Java - Diff between revs 22 and 23
Subversion Repositories:
(root)/Frameworks and Technologies/RTMPChecker/src/main/java/execprocess/execprocess/StreamChecker.java
Rev 22 | Rev 23 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | import java.util.LinkedList; | 5 | import java.util.LinkedList; | |
6 | import java.util.List; | 6 | import java.util.List; | |
7 | 7 | |||
8 | import org.apache.commons.exec.*; | 8 | import org.apache.commons.exec.*; | |
9 | 9 | |||
10 | public class StreamChecker implements Runnable{ | - | ||
- | 10 | public class StreamChecker { | ||
11 | 11 | |||
12 | public static final boolean DEBUG = true; | 12 | public static final boolean DEBUG = true; | |
13 | public final long timeout = 15000; | 13 | public final long timeout = 15000; | |
14 | public final boolean background = false; | 14 | public final boolean background = false; | |
15 | 15 | |||
Line 17... | Line 17... | |||
17 | StreamChecker tr = new StreamChecker(); | 17 | StreamChecker tr = new StreamChecker(); | |
18 | /*for(int i=0;i<3;i++){ | 18 | /*for(int i=0;i<3;i++){ | |
19 | Thread t = new Thread(new TestRtmp()); | 19 | Thread t = new Thread(new TestRtmp()); | |
20 | t.start(); | 20 | t.start(); | |
21 | }*/ | 21 | }*/ | |
- | 22 | |||
- | 23 | if(args.length==0 || args[0] == null) | ||
- | 24 | { | ||
- | 25 | System.err.println("Stream id must be speciffied."); | ||
- | 26 | System.exit(0); | ||
- | 27 | } | ||
22 | 28 | |||
23 | System.out.print("Is live ? "); | 29 | System.out.print("Is live ? "); | |
24 | boolean isLive = tr.checkLiveStream("rtmp://XYZYXYXYXYYX"); | - | ||
- | 30 | boolean isLive = tr.checkLiveStream("rtmp://54.172.91.50:1935/05MediaLiveBroadcast/"+args[0]); | ||
25 | 31 | |||
26 | System.out.println(isLive); | - | ||
- | 32 | if(isLive) | ||
- | 33 | System.out.println("STREAM IS LIVE!"); | ||
- | 34 | else | ||
- | 35 | System.out.println("STREAM IS NOT LIVE."); | ||
- | 36 | // System.out.println(isLive); | ||
27 | } | 37 | } | |
28 | 38 | |||
29 | public void run(){ | - | ||
- | 39 | /* public void run(){ | ||
30 | try { | 40 | try { | |
31 | checkLiveStream("rtmp://XYZYXYXYXYYX"); | - | ||
- | 41 | checkLiveStream("rtmp://54.172.91.50:1935/05MediaLiveBroadcast/"+args[1]); | ||
32 | } catch (Exception e) { | 42 | } catch (Exception e) { | |
33 | e.printStackTrace(); | 43 | e.printStackTrace(); | |
34 | } | 44 | } | |
35 | } | - | ||
- | 45 | }*/ | ||
36 | 46 | |||
37 | 47 | |||
38 | public boolean checkLiveStream(String streamUrl) throws Exception { | 48 | public boolean checkLiveStream(String streamUrl) throws Exception { | |
39 | 49 | |||
40 | RtmpDumpHandler printResult; | 50 | RtmpDumpHandler printResult; |