2017-02-15 2 views
0

Ich verwende ExoPlayer, um Audio von einer URL abzuspielen. Ich habe Untertitel im XML-Format, die wie folgt aussehen:ExoPlayer: Untertitel anzeigen

[ 
    { 
     "id": 1, 
     "startTime": "00:00:00", 
     "endTime": "00:00:05", 
     "textEn": "towns, in late 15th-century England.", 
     "textRu": null 
    }, 
    { 
     "id": 2, 
     "startTime": "00:00:05", 
     "endTime": "00:00:10", 
     "textEn": "the first thing to note is that in stark contrast to today, England was an overwhelmingly rural country.", 
     "textRu": null 
    } 
] 

Ich weiß, dass es einen Weg gibt Untertitel zu zeigen, während mit ExoPlayer spielen. Allerdings habe ich alles im Entwicklerhandbuch gescannt: ExoPlayer Developer's guide, habe aber nicht gefunden, wie das geht, weil die Dokumentation wirklich schlecht ist. Auch ist das XML-Format der Untertitel für ExoPlayer geeignet und wenn jetzt, wie sollte ich sie konvertieren und in welches Format. ExoPlayer Ninjas bitte helfen Sie mir)

Antwort

0

können Sie Ihre JSON in .str-Format konvertieren und speichern Sie es als Datei. Jetzt kann der ExoPlayer die .str-Datei anzeigen. Hier ist ein Beispiel für das str-Format:

1 
00:02:17,440 --> 00:02:20,375 
Senator, we're making 
our final approach into Coruscant. 

2 
00:02:20,476 --> 00:02:22,501 
Very good, Lieutenant.