xcode4.3 - How to use .srt file to show subtitles in xcode -


i need show subtitle under video in xcode.. knew can use .srt file show subtitles..i can parse .srt file.. problem don't know how make text in .srt file show under video, how set time intervals .. please me

i got stack overflow link.... forgot link... code in link this-

nsstring *path = [[nsbundle mainbundle] pathforresource:@"srtfilename" oftype:@"srt"];  nsstring *string = [nsstring stringwithcontentsoffile:path encoding:nsutf8stringencoding error:null];  nsscanner *scanner = [nsscanner scannerwithstring:string];  while (![scanner isatend])    {      @autoreleasepool      {        nsstring *indexstring;         (void) [scanner scanuptocharactersfromset:[nscharacterset newlinecharacterset] intostring:&indexstring];         nsstring *startstring;        (void) [scanner scanuptostring:@" --> " intostring:&startstring];         // string constant doesn't begin spaces because scanners        // skip spaces , newlines default.        (void) [scanner scanstring:@"-->" intostring:null];         nsstring *endstring;        (void) [scanner scanuptocharactersfromset:[nscharacterset newlinecharacterset] intostring:&endstring];         nsstring *textstring;        // (void) [scanner scanuptocharactersfromset:[nscharacterset newlinecharacterset] intostring:&textstring];                 // begin edit        (void) [scanner scanuptostring:@"\r\n\r\n" intostring:&textstring];        textstring = [textstring stringbyreplacingoccurrencesofstring:@"\r\n" withstring:@" "];        // addresses trailing space added if crlf on line @ end of srt file        textstring = [textstring stringbytrimmingcharactersinset:[nscharacterset whitespacecharacterset]];       // end edit         nsdictionary *dictionary = [nsdictionary dictionarywithobjectsandkeys:                                             indexstring , @"index",                                             startstring, @"start",                                             endstring , @"end",                                             textstring , @"text",                                             nil];         nslog(@"%@", dictionary); } } 

i did parse srt file this... added uitextview on movie player(mpmoviecontrolstylenone) view.... did change text automatically using startstring , endstring using timer... can play , pause player custom play , pause button...


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -