Android - ExoPlayer2字幕

时间:2016-09-30 19:31:49

标签: android exoplayer subtitle exoplayer2.x

如何在ExoPlayer2上设置字幕? 我试过这个tu bild MergingMediaSource:

key=value

但是我收到了这个错误:

$_POST

2 个答案:

答案 0 :(得分:1)

+ (NSString *) stringToHex:(NSString *)str{
NSInteger result = [str integerValue];
NSString *hexStr = (result)?@"":@"0";

while (result!=0) {
     NSInteger reminder = result % 16;

    if(reminder>=0 && reminder<=9){
        hexStr = [[NSString stringWithFormat:@"%ld",(long)reminder] stringByAppendingString:hexStr];
    }else if(reminder==10){
        hexStr = [@"A" stringByAppendingString:hexStr];
    }else if(reminder==11){
        hexStr = [@"B" stringByAppendingString:hexStr];
    }else if(reminder==12){
        hexStr = [@"C" stringByAppendingString:hexStr];
    }else if(reminder==13){
        hexStr = [@"D" stringByAppendingString:hexStr];
    }else if(reminder==14){
        hexStr = [@"E" stringByAppendingString:hexStr];
    }else{
        hexStr = [@"F" stringByAppendingString:hexStr];
    }

    result /=16;
}

return hexStr;

more ...

答案 1 :(得分:-2)

那是因为您在SourceLoadable课程中的Exoplayer版本中存在错误,您可以修改此更改此行:

private byte[] sampleData;

private byte[] sampleData = new byte[INITIAL_SAMPLE_SIZE];

或使用Exoplayer最新版本。