How to get Video/Audio file details played currently in the MediaRenderer?

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

How to get Video/Audio file details played currently in the MediaRenderer?

rsahu
Hi there,

I am currently able to play a single video/audio file in the MediaRenderer. How ever, I just wanted to get the details back to my Client Application about the Video/Audio files played currently in the Mediarenderer.

Is there any API available in Cling, using which I can get the details of the file played currently in the mediaRenderer side? Please share your thoughts on this.

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

Anil Rathore
I was also trying the same ...but did not found any callback method that does this or there is no such API exposed by cling which tells the controller what is currently being played on media renderer device. still if anyone has done this using cling then please comment..
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

bergstr
GetMediaInfo in AVTransport service
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

rsahu
I tried to get the details using GetMediaInfo. The code and result I got is as follows:

Code:
public void getMediaInfoFromRenderer (Device device)
    {
           ServiceId serviceId = new UDAServiceId("AVTransport");
            Service service = device.findService(serviceId);
           
            ControlPoint cp = upnpService.getControlPoint();
           
            ActionCallback getMediaInfoAction = new GetMediaInfo(service) {
                               
                                @Override
                                public void failure(ActionInvocation arg0, UpnpResponse arg1, String arg2) {
                                        // TODO Auto-generated method stub
                                        upnpMessageListener.failureActionCallback("FAIL getMediaInfoAction"+arg2);
                                }
                               
                                @Override
                                public void received(ActionInvocation arg0, MediaInfo arg1) {
                                        // TODO Auto-generated method stub
                                       
                                        MediaInfo mediaInfo = arg1;
                                        Log.i(TAG,"mediaInfo.getCurrentURI() = "+mediaInfo.getCurrentURI());
                                        Log.i(TAG,"mediaInfo.getCurrentURIMetaData() = "+mediaInfo.getCurrentURIMetaData());
                                        Log.i(TAG,"mediaInfo.getMediaDuration() = "+mediaInfo.getMediaDuration());
                                        Log.i(TAG,"mediaInfo.getNextURI() = "+mediaInfo.getNextURI());
                                        Log.i(TAG,"mediaInfo.getNextURIMetaData() = "+mediaInfo.getNextURIMetaData());
                                        Log.i(TAG,"mediaInfo.getNumberOfTracks() = "+mediaInfo.getNumberOfTracks());
                                        Log.i(TAG,"mediaInfo.getPlayMedium() = "+mediaInfo.getPlayMedium());
                                        Log.i(TAG,"mediaInfo.getRecordMedium() = "+mediaInfo.getRecordMedium());
                                        Log.i(TAG,"mediaInfo.getWriteStatus() = "+mediaInfo.getWriteStatus());
                                       
                                }
                        };
            try
            {
            getMediaInfoAction.setControlPoint(cp);
            getMediaInfoAction.run();
            }
            catch(Exception e)
            {
                  Log.i(TAG,"getMediaInfoAction = "+e.getMessage());
                return;
            }    
           
    }

The result of the above code is:

04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getCurrentURI() = http://172.27.47.175:54628/my-dlna-server_text-item-11
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getCurrentURIMetaData() = NO METADATA
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getMediaDuration() = 00:00:00
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getNextURI() = NOT_IMPLEMENTED
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getNextURIMetaData() = NOT_IMPLEMENTED
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getNumberOfTracks() = 0
04-09 15:23:22.490: I/UPnPManager(6028): mediaInfo.getPlayMedium() = NONE
04-09 15:23:22.495: I/UPnPManager(6028): mediaInfo.getRecordMedium() = NOT_IMPLEMENTED
04-09 15:23:22.495: I/UPnPManager(6028): mediaInfo.getWriteStatus() = NOT_IMPLEMENTED


As shown above the result I received is not proper. There is no MediaDuration and other details.

Please comment on the above output. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

bergstr
what makes you think above the result is not proper?
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

rsahu
The duration should come as expected, but it's coming as 00:00:00

mediaInfo.getMediaDuration() = 00:00:00 .

What do you think, the way I get the media info is correct or am I doing something wrong. Please let me know.
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

bergstr
looks correct to me. You even get a currentURI, although the URL (http://172.27.47.175:54628/my-dlna-server_text-item-11) looks a little strange for a music or video item. What are you playing on the device? IS the device really playing?
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

rsahu
Yes, the device is playing a Video file. The URI is also correct. First I pass the URI to play as a single file. Then I am trying to get the media info details. But the result is as shown in my previous posts.
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

bergstr
look in the UPnP spec. Maybe the mediaduration is not computed on-device, but has to be passed by the control point (like the metadata). There are other duration properties as well, check them. I'm out of here.
Reply | Threaded
Open this post in threaded view
|

Re: How to get Video/Audio file details played currently in the MediaRenderer?

river
In reply to this post by Anil Rathore
Play the English name of the song is not a problem, but not always play Chinese name song

http://192.168.20.128:42926/storage/sdcard0/zuijiu.mp3 -->ok
http://192.168.20.128:42926/storage/sdcard0/醉酒.mp3--->error

this is code:
 upnpService.getControlPoint().execute(new SetAVTransportURI(new UnsignedIntegerFourBytes(0), service, url, "NO METADATA");

How can I do?please。。