Java Code Examples for org.fourthline.cling.model.ModelUtil#toTimeString()
The following examples show how to use
org.fourthline.cling.model.ModelUtil#toTimeString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PositionInfo.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public PositionInfo(PositionInfo copy, long relTimeSeconds, long absTimeSeconds) { this.track = copy.track; this.trackDuration = copy.trackDuration; this.trackMetaData = copy.trackMetaData; this.trackURI = copy.trackURI; this.relTime = ModelUtil.toTimeString(relTimeSeconds); this.absTime = ModelUtil.toTimeString(absTimeSeconds); this.relCount = copy.relCount; this.absCount = copy.absCount; }
Example 2
Source File: ZxtMediaPlayer.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public void positionChanged(int position) { log.fine("Position Changed event received: " + position); synchronized (ZxtMediaPlayer.this) { currentPositionInfo = new PositionInfo(1, currentMediaInfo.getMediaDuration(), currentMediaInfo.getCurrentURI(), ModelUtil.toTimeString(position/1000), ModelUtil.toTimeString(position/1000)); } }
Example 3
Source File: ZxtMediaPlayer.java From TVRemoteIME with GNU General Public License v2.0 | 5 votes |
public void durationChanged(int duration) { log.fine("Duration Changed event received: " + duration); synchronized (ZxtMediaPlayer.this) { String newValue = ModelUtil.toTimeString(duration/1000); currentMediaInfo = new MediaInfo(currentMediaInfo.getCurrentURI(), "", new UnsignedIntegerFourBytes(1), newValue, StorageMedium.NETWORK); getAvTransportLastChange().setEventedValue(getInstanceId(), new AVTransportVariable.CurrentTrackDuration(newValue), new AVTransportVariable.CurrentMediaDuration(newValue)); } }
Example 4
Source File: MediaResourceDao.java From BeyondUPnP with Apache License 2.0 | 5 votes |
public static List<Item> getAudioList(String serverUrl, String parentId) { List<Item> items = new ArrayList<>(); //Query all track,add to items Cursor c = BeyondApplication.getApplication().getContentResolver() .query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Audio.Media.TITLE); c.moveToFirst(); while (!c.isAfterLast()) { long id = c.getLong(c.getColumnIndex(MediaStore.Audio.Media._ID)); String title = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE)); String creator = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST)); String album = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.ALBUM)); String data = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA)); //Remove SDCard path data = data.replaceFirst(storageDir, ""); //Replace file name by "id.ext" String fileName = data.substring(data.lastIndexOf(File.separator)); String ext = fileName.substring(fileName.lastIndexOf(".")); data = data.replace(fileName, File.separator + id + ext); String mimeType = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Media.MIME_TYPE)); long size = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.SIZE)); long duration = c.getLong(c.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION)); //Get duration string String durationStr = ModelUtil.toTimeString(duration); //Compose audio url String url = serverUrl + File.separator + "audio" + File.separator + data; Res res = new Res(mimeType, size, durationStr, null, url); items.add(new MusicTrack(String.valueOf(id), parentId, title, creator, album, new PersonWithRole(creator), res)); c.moveToNext(); } return items; }
Example 5
Source File: MediaResourceDao.java From BeyondUPnP with Apache License 2.0 | 5 votes |
public static List<Item> getVideoList(String serverUrl, String parentId) { List<Item> items = new ArrayList<>(); Cursor c = BeyondApplication.getApplication().getContentResolver() .query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, null, null, null, MediaStore.Video.Media.TITLE); c.moveToFirst(); while (!c.isAfterLast()) { long id = c.getLong(c.getColumnIndex(MediaStore.Audio.Media._ID)); String title = c.getString(c.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE)); String creator = c.getString(c.getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST)); String data = c.getString(c.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); //Remove SDCard path data = data.replaceFirst(storageDir, ""); //Replace file name by "id.ext" String fileName = data.substring(data.lastIndexOf(File.separator)); String ext = fileName.substring(fileName.lastIndexOf(".")); data = data.replace(fileName, File.separator + id + ext); String mimeType = c.getString(c.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE)); long size = c.getLong(c.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE)); long duration = c.getLong(c.getColumnIndexOrThrow(MediaStore.Video.Media.DURATION)); //Get duration string String durationStr = ModelUtil.toTimeString(duration); //Compose audio url String url = serverUrl + File.separator + "video" + File.separator + data; Res res = new Res(mimeType, size, durationStr, null, url); items.add(new Movie(String.valueOf(id), parentId, title, creator, res)); c.moveToNext(); } return items; }
Example 6
Source File: PositionInfo.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public PositionInfo(PositionInfo copy, long relTimeSeconds, long absTimeSeconds) { this.track = copy.track; this.trackDuration = copy.trackDuration; this.trackMetaData = copy.trackMetaData; this.trackURI = copy.trackURI; this.relTime = ModelUtil.toTimeString(relTimeSeconds); this.absTime = ModelUtil.toTimeString(absTimeSeconds); this.relCount = copy.relCount; this.absCount = copy.absCount; }
Example 7
Source File: ZxtMediaPlayer.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public void positionChanged(int position) { log.fine("Position Changed event received: " + position); synchronized (ZxtMediaPlayer.this) { currentPositionInfo = new PositionInfo(1, currentMediaInfo.getMediaDuration(), currentMediaInfo.getCurrentURI(), ModelUtil.toTimeString(position/1000), ModelUtil.toTimeString(position/1000)); } }
Example 8
Source File: ZxtMediaPlayer.java From DroidDLNA with GNU General Public License v3.0 | 5 votes |
public void durationChanged(int duration) { log.fine("Duration Changed event received: " + duration); synchronized (ZxtMediaPlayer.this) { String newValue = ModelUtil.toTimeString(duration/1000); currentMediaInfo = new MediaInfo(currentMediaInfo.getCurrentURI(), "", new UnsignedIntegerFourBytes(1), newValue, StorageMedium.NETWORK); getAvTransportLastChange().setEventedValue(getInstanceId(), new AVTransportVariable.CurrentTrackDuration(newValue), new AVTransportVariable.CurrentMediaDuration(newValue)); } }