/** * Returns the video descriptor * * @return Video descriptor * @throws RemoteException * @see VideoDescriptor */ public VideoDescriptor getVideoDescriptor() throws RemoteException { try { final VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId); if (session == null) { return mPersistentStorage.getVideoDescriptor(); } IVideoPlayer player = session.getPlayer(); if (player != null) { VideoCodec codec = player.getCodec(); return new VideoDescriptor(codec.getWidth(), codec.getHeight()); } VideoContent content = (VideoContent) session.getContent(); return new VideoDescriptor(content.getWidth(), content.getHeight()); } catch (ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch (Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }
/** * Return the video encoding (eg. H.264) * * @return Encoding * @throws RemoteException */ public String getVideoEncoding() throws RemoteException { try { final VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId); if (session == null) { return mPersistentStorage.getVideoEncoding(); } IVideoPlayer player = session.getPlayer(); if (player == null) { throw new ServerApiGenericException( "Cannot get video encoding for session with sharing ID:".concat(mSharingId)); } VideoCodec codec = player.getCodec(); if (codec == null) { throw new ServerApiGenericException( "Cannot get video codec for session with sharing ID:".concat(mSharingId)); } return codec.getEncoding(); } catch (ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch (Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }
/** * Returns the state of the sharing * * @return State * @throws RemoteException * @see State */ public int getState() throws RemoteException { try { VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId); if (session == null) { return mPersistentStorage.getState().toInt(); } SipDialogPath dialogPath = session.getDialogPath(); if (dialogPath != null && dialogPath.isSessionEstablished()) { return State.STARTED.toInt(); } else if (session.isInitiatedByRemote()) { if (session.isSessionAccepted()) { return State.ACCEPTING.toInt(); } return State.INVITED.toInt(); } return State.INITIATING.toInt(); } catch (ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch (Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }
/** * Returns the local timestamp of when the video sharing was initiated for outgoing video sharing * or the local timestamp of when the video sharing invitation was received for incoming video * sharings. * * @return Timestamp in milliseconds * @throws RemoteException */ public long getTimestamp() throws RemoteException { try { final VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId); if (session == null) { return mPersistentStorage.getTimestamp(); } return session.getTimestamp(); } catch (ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch (Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }
/** * Returns the direction of the sharing (incoming or outgoing) * * @return Direction * @throws RemoteException * @see Direction */ public int getDirection() throws RemoteException { try { VideoStreamingSession session = mRichcallService.getVideoSharingSession(mSharingId); if (session == null) { return mPersistentStorage.getDirection().toInt(); } if (session.isInitiatedByRemote()) { return Direction.INCOMING.toInt(); } return Direction.OUTGOING.toInt(); } catch (ServerApiBaseException e) { if (!e.shouldNotBeLogged()) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); } throw e; } catch (Exception e) { sLogger.error(ExceptionUtil.getFullStackTrace(e)); throw new ServerApiGenericException(e); } }