streamin mp4 from android phone to TV

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

streamin mp4 from android phone to TV

Andy

I need a simple streaming mp4 (from server) from android phone to TV ...
Use the following code:

  // Start action from device list
  listview.setOnItemClickListener(new OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
                    DeviceDisplay selectedItem = (DeviceDisplay) parent.getAdapter().getItem(position);
                        Device device = selectedItem.getDevice();
                       
                        if(selectedItem.getDevice().getType().getType().equals("MediaRenderer"))
                        {
                                ServiceId serviceId = new UDAServiceId("AVTransport");
                                Service service = device.findService(serviceId);
                                setContent(service);
                        }
                        else
                        {
                        // Error ....
                        }
                }
     
     
    // Play action
    public ActionCallback getPlayAction(Service service) {
        ActionCallback playAction = new Play(service) {
                @Override
                public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
                // PlayAction error ....
                }
               
        };
        return playAction;
    }
   
    // Start streaming process ...
    public void setContent(final Service service) {
    try{
                ActionCallback setAVTransportURIAction = new SetAVTransportURI(service, "http://techslides.com/demos/sample-videos/small.mp4", "") {
                @Override
                public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
                // AVTransport error ....
                }

                @Override
                public void success(ActionInvocation invocation) {
                    ActionCallback playAction = getPlayAction(service);
                    playAction.setControlPoint(upnpService.getControlPoint());
                    playAction.run();
                }
                };
                setAVTransportURIAction.setControlPoint(upnpService.getControlPoint());
                setAVTransportURIAction.run();
    }
    catch (Exception e)
    {
    // Streamin error ...
    }

    }

After starting - TV in a black screen, nothing happens
I think, need to generate specific profiles for each type of TV (Samsung, LG, Philips, etc) didl-lite and use them as the last parameter in the function SetAVTransportURI?

Please help me, if posiible - with sample:)
Reply | Threaded
Open this post in threaded view
|

Re: streamin mp4 from android phone to TV

Christian Bauer
Administrator
This is much more complicated than you think it is.

You will have to read the (expensive) DLNA specifications, then realize it's all bullshit and nobody really cares about standards, then analyze what others are doing with wireshark depending on each TV manufacturer and whether it's raining or a full moon, then hopelessly hack at your keyboard trying to emulate that.

There is a reason why all UPnP/DLNA controlpoints which work with current TV models are a) closed source b) cost money and c) keep how they work a closely guarded secret.
Reply | Threaded
Open this post in threaded view
|

Re: streamin mp4 from android phone to TV

Andy
Thanks for the clarification ...
But still ... how to use your library to generate the correct DIDL-Lite? While I was generating it from a template string, but it's not quite right :)
If it possible, small sample (cling 2.0)
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: streamin mp4 from android phone to TV

Christian Bauer
Administrator
I don't know about "correct" because there is a huge difference between semantically correct and actually working. But of course the basic usage of the DIDL support functions is documented in the manual.