fyhertz / libstreaming-examples

Some examples of how to use libstreaming
284 stars 233 forks source link

[Solved] Example3 doesn't work on MacOs #1

Open Nikita2k opened 11 years ago

Nikita2k commented 11 years ago

Os: MacOs 10.8 Device: Samsung galaxy s2 android 4.0.4 Situation: followed all steps from tutorial.Viewing stream from browser is not available (player shows an error: "Error loading stream : ID not found on server"). Expected: normal streaming to browser

Wowza Server logs: (192.168.0.104 is running wowza server, 192.168.0.103 - pc with apache, test page 192.168.0.103:1935 is available)

Configure logging: file:///Library/WowzaMediaServer/conf/log4j.properties INFO server server-start Wowza Media Server 3 Developer Edition (Expires: ??? 27, 2014) 3.6.2 build5334 - INFO server comment - Server License Key: SVRB3-XXXXX-XXXXX-XXXXX-XXXXX-xB7Nb INFO server comment - Maximum Connections: 10 INFO server comment - Transcoder Streams Available: Transcoder Not Available (osx-64) INFO server comment - nDVR Available: Yes INFO server comment - DRM Available: Yes INFO server comment - Hardware Available Processors: 4 INFO server comment - Hardware Physical Memory: 69MB/8192MB INFO server comment - Hardware Swap Space: 1009MB/4096MB INFO server comment - Max File Descriptor Count: 10240 INFO server comment - Open File Descriptor Count: 72 INFO server comment - OS Name: Mac OS X INFO server comment - OS Version: 10.8.5 INFO server comment - OS Architecture: x86_64 INFO server comment - Java Name: Java HotSpot(TM) 64-Bit Server VM INFO server comment - Java Vendor: Apple Inc. INFO server comment - Java Version: 1.6.0_51 INFO server comment - Java VM Version: 20.51-b01-457 INFO server comment - Java Spec Version: 1.6 INFO server comment - Java Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home INFO server comment - Java Max Heap Size: 682MB INFO server comment - Java Architecture: 64 INFO server comment - Java Locale[user.language]: ru INFO server comment - Java Locale[user.country]: RU INFO server comment - Java Locale[file.encoding]: MacCyrillic INFO server comment - Java Timezone[user.timezone]: Asia/Yekaterinburg INFO server comment - Java Args[0]: -Xserver INFO server comment - Java Args[1]: -Xmx768M INFO server comment - Java Args[2]: -Dcom.sun.management.jmxremote=true INFO server comment - Java Args[3]: -Dcom.wowza.wms.runmode=standalone INFO server comment - Java Args[4]: -Dcom.wowza.wms.native.base=osx INFO server comment - Java Args[5]: -Dcom.wowza.wms.AppHome=/Library/WowzaMediaServer INFO server comment - Java Args[6]: -Dcom.wowza.wms.ConfigURL= INFO server comment - Java Args[7]: -Dcom.wowza.wms.ConfigHome=/Library/WowzaMediaServer INFO server comment - Server runmode: standalone INFO server comment - Server native.platform: osx INFO server comment - Server threads[h/t]: 10/10 INFO server comment - CMDInterface now listening: [any]:8083 INFO vhost vhost-start defaultVHost - INFO server comment - defaultVHost threads[h/t]:120/80 home:/Library/WowzaMediaServer INFO vhost comment defaultVHost Bind attempt ([any]:1935:4) INFO vhost comment defaultVHost Bind successful ([any]:1935) INFO vhost comment defaultVHost Bind attempt ([any]:8086:1) INFO vhost comment defaultVHost Bind successful ([any]:8086) INFO server comment - Server.startShutdownHook: Start server shutdown hook INFO server comment - Wowza Media Server is started! INFO application app-start definst live/definst INFO rtsp connect 454690399 - INFO stream create - - INFO rtsp announce 454690399 - INFO server comment - RTPUDPTransport.bind[live/definst]: 0.0.0.0/0.0.0.0:6970 INFO server comment - RTPUDPTransport.bind[live/definst]: 0.0.0.0/0.0.0.0:6971 WARN server comment - RTSPRequestAdapter.getAuthenticationHandler: Unknown method: 0 WARN server comment - RTSPRequestAdapter.service: Unknown method: unknown INFO session connect-pending 192.168.0.103 - INFO session connect 192.168.0.103 - INFO stream create - - INFO stream destroy test.stream - INFO session disconnect 1450979579 -

I've also tried to see through VLC, but nothing happened.

fyhertz commented 11 years ago

Hi,

Is the example 3 streaming to wowza ? What message do you get when you press "start" in the example 3 ?

This error is normal as long as the RTSP client of the example 3 is not connected to the RTSP server of wowza. So if you haven't press start in the example 3, you will get this message. If you did press start, then I need to know what error you got from the example 3 ?

Regards,

fyhertz commented 11 years ago

Also, see what I said to this folks, may help you as well: https://github.com/fyhertz/libstreaming-examples/issues/2

Nikita2k commented 11 years ago

As you recommended in issue #2 I've removed "\r\n", but problem remains.

Webpage player shows: "Error loading stream: ID not found on server" I've traced code and I see it stops on

    mClient.startStream(1);

and nothing happens...

fyhertz commented 11 years ago

Hi,

Could you paste logs from logcat here, so that I know where the problem is exactly.

Thanks

Nikita2k commented 11 years ago

Hi!, here you go...

10-28 00:15:53.408: DEBUG/VideoStream(17886): Surface Changed ! 10-28 00:16:06.168: INFO/RtspClient(17886): ANNOUNCE rtsp:// 192.168.0.102:1935/live/test.stream RTSP/1.0 10-28 00:16:06.658: DEBUG/RtspClient(17886): Response from server: 401 10-28 00:16:06.658: VERBOSE/RtspClient(17886): RTSP server name: Wowza Media Server 3.6.2 build5334 10-28 00:16:06.663: INFO/RtspClient(17886): ANNOUNCE rtsp:// 192.168.0.102:1935/live/test.stream RTSP/1.0 10-28 00:16:06.778: DEBUG/RtspClient(17886): Response from server: 200 10-28 00:16:06.783: INFO/RtspClient(17886): SETUP rtsp:// 192.168.0.102:1935/live/test.stream/trackID=0 RTSP/1.0 10-28 00:16:06.868: DEBUG/RtspClient(17886): Response from server: 200 10-28 00:16:06.868: DEBUG/RtspClient(17886): Setting destination ports: 6970, 6971 10-28 00:16:06.873: INFO/RtspClient(17886): SETUP rtsp:// 192.168.0.102:1935/live/test.stream/trackID=1 RTSP/1.0

Here is wowza logs: Last login: Sun Oct 27 23:28:03 on ttys003 Mac-mini-Nikita:~ admin$ cd /Library/WowzaMediaServer/bin;./startup.sh;exit Configure logging: file:///Library/WowzaMediaServer/conf/log4j.properties log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /Library/WowzaMediaServer/logs/wowzamediaserver_access.log (Permission denied) at java.io.FileOutputStream.openAppend(Native Method) at java.io.FileOutputStream.(FileOutputStream.java:192) at java.io.FileOutputStream.(FileOutputStream.java:116) at org.apache.log4j.FileAppender.setFile(Unknown Source) at org.apache.log4j.FileAppender.activateOptions(Unknown Source) at org.apache.log4j.DailyRollingFileAppender.activateOptions(Unknown Source) at org.apache.log4j.config.PropertySetter.activate(Unknown Source) at org.apache.log4j.config.PropertySetter.setProperties(Unknown Source) at org.apache.log4j.config.PropertySetter.setProperties(Unknown Source) at org.apache.log4j.PropertyConfigurator.parseAppender(Unknown Source) at org.apache.log4j.PropertyConfigurator.parseCategory(Unknown Source) at org.apache.log4j.PropertyConfigurator.configureRootCategory(Unknown Source) at org.apache.log4j.PropertyConfigurator.doConfigure(Unknown Source) at org.apache.log4j.PropertyConfigurator.configure(Unknown Source) at com.wowza.wms.logging.WMSLoggerFactory.initializeLogging(Unknown Source) at com.wowza.wms.logging.WMSLoggerFactory.initializeLogging(Unknown Source) at com.wowza.wms.server.Server.b(Unknown Source) at com.wowza.wms.server.Server.start(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.wowza.wms.bootstrap.Bootstrap.startServer(Unknown Source) at com.wowza.wms.bootstrap.Bootstrap.main(Unknown Source) log4j:ERROR Either File or DatePattern options are not set for appender [serverAccess]. INFO server server-start Wowza Media Server 3 Developer Edition (Expires: ??? 27, 2014) 3.6.2 build5334 - INFO server comment - Server License Key: SVRB3-XXXXX-XXXXX-XXXXX-XXXXX-xB7Nb INFO server comment - Maximum Connections: 10 INFO server comment - Transcoder Streams Available: Transcoder Not Available (osx-64) INFO server comment - nDVR Available: Yes INFO server comment - DRM Available: Yes INFO server comment - Hardware Available Processors: 4 INFO server comment - Hardware Physical Memory: 55MB/8192MB INFO server comment - Hardware Swap Space: 502MB/6144MB INFO server comment - Max File Descriptor Count: 10240 INFO server comment - Open File Descriptor Count: 70 INFO server comment - OS Name: Mac OS X INFO server comment - OS Version: 10.8.5 INFO server comment - OS Architecture: x86_64 INFO server comment - Java Name: Java HotSpot(TM) 64-Bit Server VM INFO server comment - Java Vendor: Apple Inc. INFO server comment - Java Version: 1.6.0_51 INFO server comment - Java VM Version: 20.51-b01-457 INFO server comment - Java Spec Version: 1.6 INFO server comment - Java Home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home INFO server comment - Java Max Heap Size: 682MB INFO server comment - Java Architecture: 64 INFO server comment - Java Locale[user.language]: ru INFO server comment - Java Locale[user.country]: RU INFO server comment - Java Locale[file.encoding]: MacCyrillic INFO server comment - Java Timezone[user.timezone]: Asia/Yekaterinburg INFO server comment - Java Args[0]: -Xserver INFO server comment - Java Args[1]: -Xmx768M INFO server comment - Java Args[2]: -Dcom.sun.management.jmxremote=true INFO server comment - Java Args[3]: -Dcom.wowza.wms.runmode=standalone INFO server comment - Java Args[4]: -Dcom.wowza.wms.native.base=osx INFO server comment - Java Args[5]: -Dcom.wowza.wms.AppHome=/Library/WowzaMediaServer INFO server comment - Java Args[6]: -Dcom.wowza.wms.ConfigURL= INFO server comment - Java Args[7]: -Dcom.wowza.wms.ConfigHome=/Library/WowzaMediaServer INFO server comment - Server runmode: standalone INFO server comment - Server native.platform: osx INFO server comment - Server threads[h/t]: 10/10 INFO server comment - CMDInterface now listening: [any]:8083 INFO vhost vhost-start defaultVHost - INFO server comment - defaultVHost threads[h/t]:120/80 home:/Library/WowzaMediaServer INFO vhost comment defaultVHost Bind attempt ([any]:1935:4) INFO vhost comment defaultVHost Bind successful ([any]:1935) INFO vhost comment defaultVHost Bind attempt ([any]:8086:1) INFO vhost comment defaultVHost Bind successful ([any]:8086) INFO server comment - Server.startShutdownHook: Start server shutdown hook INFO server comment - Wowza Media Server is started! INFO application app-start definst live/definst INFO rtsp connect 2121801538 - INFO stream create - - INFO rtsp announce 2121801538 - INFO server comment - RTPUDPTransport.bind[live/definst]: 0.0.0.0/0.0.0.0:6970 INFO server comment - RTPUDPTransport.bind[live/definst]: 0.0.0.0/0.0.0.0:6971 WARN server comment - RTSPRequestAdapter.getAuthenticationHandler: Unknown method: 0 WARN server comment - RTSPRequestAdapter.service: Unknown method: unknown

Nikita2k commented 11 years ago

Solution

After few nights of testing/debugging/reinstalling of wowza I came up with following solution

  1. Set stream publishing for unauthorized users: go to [wowza-dir]/conf/Application.xml and find

    <PublishMethod> 

    property. Set it to none.

    <PublishMethod>none</PublishMethod>
  2. Now start the application (example3). Change quality to maximum (320x240, 15fps, 350kbps for my Samsung Galaxy s2). Minimum quality is NOT working for my phone!
  3. Start server, than start streaming. If app successfully connected to wowza "Start" button should change to "Stop"
  4. Open webpage to see the stream

Additional info

  1. Even if all steps described above done right it's not guaranteed that stream would work. Try to restart your app again!
  2. I couldn't play stream with VLC. If I type in address starting with RTMP:// - I get an error. If I type in RTSP - I hear only sound
  3. If the start button stays disabled forever, try to remove the "\r\n" at the end of the function addHeaders() in the RtspClient.java, compile and try again !
  4. Mac Os startup script must be run with SUDO!

Hope this comment helps everyone who's trying to make app running!