0
我正在製作手指手語應用程序。 我已經設法從用戶輸入中獲取字符串的子字符串。 現在,每個字母都有來自我的sqlite的相應視頻文件,我希望它在每個字母后一次播放一個視頻視圖。如何從sqlite非同時(排隊)播放多個視頻到videoView通過循環?
表:
| letter | videofilename |
| a | lettera |
| b | letterb |
| c | letterc |等等。
public void fingerspell(View v) {
CharSequence charSequence = etsearch.getText();
String s = charSequence.toString();
int startingletter = 0;
int endingletter = 1;
String desiredString;
int wordlength = etsearch.length();
do{
desiredString = s.substring(startingletter, endingletter);
Cursor c = db.rawQuery("SELECT * FROM tblletters WHERE letter like '" + desiredString + "'", null);
while (c.moveToNext()) {
Toast.makeText(getApplicationContext(), desiredString, Toast.LENGTH_LONG).show();
String video = c.getString(1);
int videoResource = getResources().
getIdentifier(video, "raw", getPackageName());
String path = "android.resource://" + getPackageName() + "/" + videoResource;
videoview.setVideoURI(Uri.parse(path));
videoview.start();
videoview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
//can't put startingletter++ here
}
});
startingletter++;
endingletter++;
}
startingletter++;
endingletter++;
}while(startingletter<wordlength);
}
只有敬酒作品,它播放第一個視頻,但不播放下一個。