Play butonuna aşağıdaki kodları yazıyoruz
procedure TForm1.Button1Click(Sender: TObject);
var
Intent: JIntent;
FileName, DestFileName: string;
Data: Jnet_Uri;
CompName: JComponentName;
const
VIDEO_FILENAME = 'videoviewdemo.mp4';
begin
FileName := System.IOUtils.TPath.GetDocumentsPath + PathDelim + VIDEO_FILENAME;
DestFileName := TPath.GetSharedDownloadsPath + PathDelim + VIDEO_FILENAME;
// Copy the file into a public path (you can use any public path)
TFile.Copy(FileName, DestFileName, true);
Data := TJnet_Uri.JavaClass.parse(StringToJString('file://' + DestFileName));
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
if CheckBox1.IsChecked then
begin
CompName := TJComponentName.JavaClass.init(StringToJString('android'),
StringToJString('com.android.internal.app.ResolverActivity'));
Intent.setComponent(CompName);
end;
Intent.setDataAndType(Data, StringToJString('video/mp4'));
try
MainActivity.startActivity(Intent);
except
on E: Exception do
begin
Label1.Text := E.Message;
end;
end;
end;
Orjinal konu için tıklayınız.
İngilizcem pek iyi sayılmaz ama anlayabildiğimce sizlere anlatmaya çalıştım.

Hiç yorum yok:
Yorum Gönder