com.google.android.exoplayer2.util.Util.parseXsDateTime()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(260)

本文整理了Java中com.google.android.exoplayer2.util.Util.parseXsDateTime()方法的一些代码示例,展示了Util.parseXsDateTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.parseXsDateTime()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:parseXsDateTime

Util.parseXsDateTime介绍

[英]Parses an xs:dateTime attribute value, returning the parsed timestamp in milliseconds since the epoch.
[中]解析xs:dateTime属性值,返回自历元以来解析的时间戳(以毫秒为单位)。

代码示例

代码示例来源:origin: google/ExoPlayer

protected static long parseDateTime(XmlPullParser xpp, String name, long defaultValue)
  throws ParserException {
 String value = xpp.getAttributeValue(null, name);
 if (value == null) {
  return defaultValue;
 } else {
  return Util.parseXsDateTime(value);
 }
}

代码示例来源:origin: google/ExoPlayer

@Override
public Long parse(Uri uri, InputStream inputStream) throws IOException {
 String firstLine = new BufferedReader(new InputStreamReader(inputStream)).readLine();
 return Util.parseXsDateTime(firstLine);
}

代码示例来源:origin: google/ExoPlayer

private static long getManifestPublishTimeMsInEmsg(EventMessage eventMessage) {
 try {
  return parseXsDateTime(Util.fromUtf8Bytes(eventMessage.messageData));
 } catch (ParserException ignored) {
  // if we can't parse this event, ignore
  return C.TIME_UNSET;
 }
}

代码示例来源:origin: google/ExoPlayer

private void resolveUtcTimingElementDirect(UtcTimingElement timingElement) {
 try {
  long utcTimestampMs = Util.parseXsDateTime(timingElement.value);
  onUtcTimestampResolved(utcTimestampMs - manifestLoadEndTimestampMs);
 } catch (ParserException e) {
  onUtcTimestampResolutionError(e);
 }
}

代码示例来源:origin: google/ExoPlayer

@Test
public void testParseXsDateTime() throws Exception {
 assertThat(parseXsDateTime("2014-06-19T23:07:42")).isEqualTo(1403219262000L);
 assertThat(parseXsDateTime("2014-08-06T11:00:00Z")).isEqualTo(1407322800000L);
 assertThat(parseXsDateTime("2014-08-06T11:00:00,000Z")).isEqualTo(1407322800000L);
 assertThat(parseXsDateTime("2014-09-19T13:18:55-08:00")).isEqualTo(1411161535000L);
 assertThat(parseXsDateTime("2014-09-19T13:18:55-0800")).isEqualTo(1411161535000L);
 assertThat(parseXsDateTime("2014-09-19T13:18:55.000-0800")).isEqualTo(1411161535000L);
 assertThat(parseXsDateTime("2014-09-19T13:18:55.000-800")).isEqualTo(1411161535000L);
}

代码示例来源:origin: google/ExoPlayer

if (playlistStartTimeUs == 0) {
 long programDatetimeUs =
   C.msToUs(Util.parseXsDateTime(line.substring(line.indexOf(':') + 1)));
 playlistStartTimeUs = programDatetimeUs - segmentStartTimeUs;

相关文章