notlarım sayfasında ses kaydını oynat butonuna basınca Ses dosyası oynatılamadı. Geçerli bir yol veya URL girin mesajı geliyor (veritabanına githuba yüklediğim ses kaydının linkini girdim)
void SaveNoteWithAudio; { try AudioFilePath = AudioFilePathEdit.Text; if AudioFilePath <> '' { Clomosy.DBSQLiteQuery.Sql.Text = 'INSERT INTO Notes (note_title, note_content, audio_path, user_id) VALUES (' + QuotedStr(notBasligiEdit.Text) + ', ' + QuotedStr(notIcerigiEdit.Text) + ', ' + QuotedStr(AudioFilePath) + ', ' + IntToStr(currentUserId) + ');'; Clomosy.DBSQLiteQuery.OpenOrExecute; ShowMessage('Not ve ses dosyası başarıyla kaydedildi!'); } else { ShowMessage('Ses dosyası yolunu girmediniz!'); } except ShowMessage('Not kaydı sırasında bir hata oluştu: ' + LastExceptionMessage); } } void ShowNotlarimScreen; var labelCounter, noteId: Integer; YPosition: Integer; titleLabel, audioLabel: TclProLabel; noteTitle, noteContent, audioPath: string; VScrollNotlarim: TCLVertScrollBox; contentPanel: TclProPanel; contentScrollBox: TCLVertScrollBox; contentLabel: TclProLabel; deleteButton,playAudioButton: TclProButton; audioIcon: TclProImage; { notlarimForm = TclForm.Create(Self);
if Assigned(notlarimForm) notlarimForm.SetFormBGImage(' https://r.resimlink.com/csd_gl.png" rel="nofollow - https://r.resimlink.com/csd_gl.png ');
VScrollNotlarim = notlarimForm.AddNewVertScrollBox(notlarimForm, 'VScrollNotlarim'); VScrollNotlarim.Align = alClient; VScrollNotlarim.Margins.Left = 25; VScrollNotlarim.Margins.Right = 25; VScrollNotlarim.Margins.Top = 10; VScrollNotlarim.Width = 300; VScrollNotlarim.Height = 450; VScrollNotlarim.ShowScrollBars = True;
YPosition = 50; labelCounter = 1;
try Clomosy.DBSQLiteQuery.Sql.Text = 'SELECT * FROM Notes WHERE user_id = ' + IntToStr(currentUserId); Clomosy.DBSQLiteQuery.OpenOrExecute;
while (not Clomosy.DBSQLiteQuery.Eof) { noteId = Clomosy.DBSQLiteQuery.FieldByName('note_id').AsInteger; noteTitle = Clomosy.DBSQLiteQuery.FieldByName('note_title').AsString; noteContent = Clomosy.DBSQLiteQuery.FieldByName('note_content').AsString; audioPath = Clomosy.DBSQLiteQuery.FieldByName('audio_path').AsString;
titleLabel = notlarimForm.AddNewProLabel(VScrollNotlarim, 'titleLabel' + IntToStr(labelCounter), noteTitle); titleLabel.Align = alTop; titleLabel.Margins.Left = 25; titleLabel.Margins.Right = 25; titleLabel.Margins.Top = 10; titleLabel.Margins.Bottom = 10; titleLabel.Width = 300; titleLabel.Height = 40; titleLabel.clProSettings.RoundWidth = 20; titleLabel.clProSettings.RoundHeight = 20; titleLabel.clProSettings.FontSize = 16; titleLabel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#3F51B5'); titleLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#FFFFFF'); titleLabel.clProSettings.WordWrap = True; titleLabel.SetclProSettings(titleLabel.clProSettings);
contentPanel = notlarimForm.AddNewProPanel(VScrollNotlarim, 'contentPanel' + IntToStr(labelCounter)); contentPanel.Align = alTop; contentPanel.Margins.Left = 25; contentPanel.Margins.Right = 25; contentPanel.Margins.Top = 5; contentPanel.Margins.Bottom = 15; contentPanel.Width = 300; contentPanel.Height = 250; contentPanel.clProSettings.RoundWidth = 15; contentPanel.clProSettings.RoundHeight = 15; contentPanel.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E0E0E0'); contentPanel.SetclProSettings(contentPanel.clProSettings);
contentScrollBox = notlarimForm.AddNewVertScrollBox(contentPanel, 'contentScrollBox' + IntToStr(labelCounter)); contentScrollBox.Align = alClient; contentScrollBox.Margins.Left = 15; contentScrollBox.Margins.Right = 15; contentScrollBox.Margins.Top = 15; contentScrollBox.Margins.Bottom = 15; contentScrollBox.Width = contentPanel.Width - 30; contentScrollBox.Height = 150; contentScrollBox.ShowScrollBars = True;
contentLabel = notlarimForm.AddNewProLabel(contentScrollBox, 'contentLabel' + IntToStr(labelCounter), noteContent); contentLabel.Align = alTop; contentLabel.Width = contentScrollBox.Width; contentLabel.Height = contentScrollBox.Height; contentLabel.clProSettings.FontSize = 14; contentLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000'); contentLabel.clProSettings.WordWrap = True; contentLabel.SetclProSettings(contentLabel.clProSettings);
if (audioPath <> '') { audioIcon = notlarimForm.AddNewProImage(contentPanel, 'audioIcon' + IntToStr(labelCounter)); audioIcon.Align = alBottom; audioIcon.Margins.Left = 15; audioIcon.Margins.Right = 5; audioIcon.Margins.Top = 5; audioIcon.Margins.Bottom = 5; audioIcon.Width = 20; audioIcon.Height = 20; audioIcon.clProSettings.PictureSource = ' https://i.hizliresim.com/cfbj0dw.png" rel="nofollow - https://i.hizliresim.com/cfbj0dw.png '; audioIcon.clProSettings.PictureAutoFit = True; audioIcon.SetclProSettings(audioIcon.clProSettings);
audioLabel = notlarimForm.AddNewProLabel(contentPanel, 'audioLabel' + IntToStr(labelCounter), audioPath); audioLabel.Align = alBottom; audioLabel.Margins.Left = 40; audioLabel.Margins.Right = 15; audioLabel.Margins.Top = 5; audioLabel.Margins.Bottom = 5; audioLabel.Width = 200; audioLabel.Height = 20; audioLabel.clProSettings.FontSize = 12; audioLabel.clProSettings.FontColor = clAlphaColor.clHexToColor('#FF5722'); audioLabel.SetclProSettings(audioLabel.clProSettings);
playAudioButton = notlarimForm.AddNewProButton(contentPanel, 'playAudioButton' + IntToStr(labelCounter), 'Oynat'); playAudioButton.Align = alBottom; playAudioButton.Margins.Left = 0; playAudioButton.Margins.Right = 15; playAudioButton.Margins.Top = 5; playAudioButton.Margins.Bottom = 5; playAudioButton.Width = 50; playAudioButton.Height = 25; playAudioButton.clProSettings.RoundWidth = 10; playAudioButton.clProSettings.RoundHeight = 10; playAudioButton.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4CAF50'); playAudioButton.clProSettings.FontColor = clAlphaColor.clHexToColor('#FFFFFF'); playAudioButton.SetclProSettings(playAudioButton.clProSettings);
notlarimForm.AddNewEvent(playAudioButton, tbeOnClick, 'PlayAudioFile'); }
deleteButton = notlarimForm.AddNewProButton(contentPanel, 'deleteButton' + IntToStr(labelCounter), 'Sil'); deleteButton.Align = alBottom; deleteButton.Margins.Left = 0; deleteButton.Margins.Right = 5; deleteButton.Margins.Top = 5; deleteButton.Margins.Bottom = 5; deleteButton.Width = 50; deleteButton.Height = 25; deleteButton.clProSettings.RoundWidth = 10; deleteButton.clProSettings.RoundHeight = 10; deleteButton.clProSettings.PictureSource = ' https://i.hizliresim.com/1kr3xb2.png" rel="nofollow - https://i.hizliresim.com/1kr3xb2.png '; deleteButton.SetclProSettings(deleteButton.clProSettings);
selectedNoteId = noteId; notlarimForm.AddNewEvent(deleteButton, tbeOnClick, 'DeleteSelectedNote');
labelCounter = labelCounter + 1; Clomosy.DBSQLiteQuery.Next; } except ShowMessage('Veritabanından notlar alınırken bir hata oluştu: ' + LastExceptionMessage); }
notlarimForm.Run; }
void PlayAudioFile; { try { if not Assigned(MediaPlayer1) { MediaPlayer1 = TclMediaPlayer.Create(Self); }
if (audioPath <> '' ) { try { MediaPlayer1.FileName = audioPath; MediaPlayer1.Play; } except ShowMessage('Ses dosyası oynatılamadı. Geçerli bir yol veya URL girin.'); } } else { ShowMessage('Ses dosyası yolu boş!'); } } except ShowMessage('Ses dosyası oynatılamadı: ' + LastExceptionMessage); } }
------------- Mustafa Çetin
|