Search in sources :

Example 1 with MediaInfo

use of org.fourthline.cling.support.model.MediaInfo in project BeyondUPnP by kevinshine.

the class PlaybackCommand method getMediaInfo.

public static void getMediaInfo(final Handler handler) {
    Device device = SystemManager.getInstance().getSelectedDevice();
    //Check selected device
    if (device == null)
        return;
    Service avtService = device.findService(SystemManager.AV_TRANSPORT_SERVICE);
    if (avtService != null) {
        ControlPoint cp = SystemManager.getInstance().getControlPoint();
        cp.execute(new GetMediaInfo(avtService) {

            @Override
            public void received(ActionInvocation invocation, MediaInfo mediaInfo) {
                Message msg = Message.obtain(handler, NowplayingFragment.GET_MEDIA_INFO_ACTION);
                msg.obj = mediaInfo;
                msg.sendToTarget();
            }

            @Override
            public void failure(ActionInvocation invocation, UpnpResponse operation, String defaultMsg) {
                Log.e(TAG, "GetMediaInfo failed");
            }
        });
    }
}
Also used : GetMediaInfo(org.fourthline.cling.support.avtransport.callback.GetMediaInfo) MediaInfo(org.fourthline.cling.support.model.MediaInfo) GetMediaInfo(org.fourthline.cling.support.avtransport.callback.GetMediaInfo) Message(android.os.Message) UpnpResponse(org.fourthline.cling.model.message.UpnpResponse) Device(org.fourthline.cling.model.meta.Device) ActionInvocation(org.fourthline.cling.model.action.ActionInvocation) Service(org.fourthline.cling.model.meta.Service) ControlPoint(org.fourthline.cling.controlpoint.ControlPoint)

Aggregations

Message (android.os.Message)1 ControlPoint (org.fourthline.cling.controlpoint.ControlPoint)1 ActionInvocation (org.fourthline.cling.model.action.ActionInvocation)1 UpnpResponse (org.fourthline.cling.model.message.UpnpResponse)1 Device (org.fourthline.cling.model.meta.Device)1 Service (org.fourthline.cling.model.meta.Service)1 GetMediaInfo (org.fourthline.cling.support.avtransport.callback.GetMediaInfo)1 MediaInfo (org.fourthline.cling.support.model.MediaInfo)1