0

I get this error - RuntimeError: eventmachine not initialized: evma_connect_to_server
RPi3 with gmediarender-resurrect

Using this library and following the basic instructions

irb(main):001:0> require 'easy_upnp'
=> true
irb(main):002:0> 
irb(main):003:0* searcher = EasyUpnp::SsdpSearcher.new 
=> #<EasyUpnp::SsdpSearcher:0x14ecbf0 @options={:timeout=>2, :mx=>1, :repeat_queries=>1}>
irb(main):004:0> devices = searcher.search 'ssdp:all'
=> [#<EasyUpnp::UpnpDevice:0x1374450 @uuid="uuid:644acae08213ec4b4ef81c9384e2df7a", @service_definitions=[{:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:AVTransport:1"}, {:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:ConnectionManager:1"}, {:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:RenderingControl:1"}]>]
irb(main):005:0> device = devices.first
=> #<EasyUpnp::UpnpDevice:0x1374450 @uuid="uuid:644acae08213ec4b4ef81c9384e2df7a", @service_definitions=[{:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:AVTransport:1"}, {:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:ConnectionManager:1"}, {:location=>"http://192.168.1.6:49494/description.xml", :st=>"urn:schemas-upnp-org:service:RenderingControl:1"}]>
irb(main):006:0> device.all_services
=> ["urn:schemas-upnp-org:service:AVTransport:1", "urn:schemas-upnp-org:service:ConnectionManager:1", "urn:schemas-upnp-org:service:RenderingControl:1"]
irb(main):007:0> service = device.service 'urn:schemas-upnp-org:service:AVTransport:1'
=> #<EasyUpnp::DeviceControlPoint:0x19e07c8 @urn="urn:schemas-upnp-org:service:AVTransport:1", @service_endpoint="http://192.168.1.6:49494/upnp/control/rendertransport1", @definition="<?xml version=\"1.0\"?>\.......
...
...
irb(main):008:0> 
irb(main):009:0>service.service_methods
=> [:GetCurrentTransportActions, :GetDeviceCapabilities, :GetMediaInfo, :GetPositionInfo, :GetTransportInfo, :GetTransportSettings, :Pause, :Play, :Seek, :SetAVTransportURI, :Stop, :SetNextAVTransportURI]
irb(main):012:0> service.Pause
RuntimeError: eventmachine not initialized: evma_connect_to_server
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.2.3/lib/eventmachine.rb:677:in `connect_server'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/eventmachine-1.2.3/lib/eventmachine.rb:677:in `bind_connect'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/em-http-request-1.1.5/lib/em-http/http_connection.rb:55:in `activate_connection'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/em-http-request-1.1.5/lib/em-http/http_connection.rb:92:in `setup_request'
    from (eval):6:in `post'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/em_http.rb:50:in `block in request'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/em_http.rb:68:in `_request'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi/adapter/em_http.rb:50:in `request'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi.rb:161:in `request'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/httpi-2.4.2/lib/httpi.rb:133:in `post'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in `block in call_with_logging'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/request_logger.rb:12:in `log'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:94:in `call_with_logging'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/operation.rb:54:in `call'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/savon-2.11.1/lib/savon/client.rb:36:in `call'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/easy_upnp-1.1.11/lib/easy_upnp/control_point/client_wrapper.rb:54:in `call'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/easy_upnp-1.1.11/lib/easy_upnp/control_point/service_method.rb:31:in `call_method'
    from /home/pi/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/easy_upnp-1.1.11/lib/easy_upnp/control_point/device_control_point.rb:205:in `block in define_service_method'
    from (irb):12
    from /home/pi/.rbenv/versions/2.3.0/bin/irb:11:in `<main>'irb(main):013:0> ^C

Aim is to control music playback (play,pause, vol up/down) from Pi terminal while audio is streamed from Android to the Pi itself.

Can't understand what the error is?

0

Got it working.
HTTPI.adapter = :net_http
This should be the adapter by default instead of Eventmachine.

And don't forget the arguments to pass for services, service.Pause(InstanceID: 0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.