2509021502
播放器流程調整 歌曲ID查詢錯誤修正 同步畫面歌曲切換畫面閃爍修正
This commit is contained in:
parent
e2a39fde2b
commit
58aa060a78
@ -524,7 +524,6 @@ namespace DualScreenDemo
|
||||
InitializeSoundEffectButtons();
|
||||
InitializeSyncScreen();
|
||||
|
||||
InitializeButtonsForSongIDSearch();
|
||||
InitializeOtherControls();
|
||||
|
||||
pictureBox1.BringToFront();
|
||||
|
@ -16,8 +16,10 @@ namespace DualScreenDemo
|
||||
|
||||
private void InitializeButtonsForSongIDSearch()
|
||||
{
|
||||
InitializeInputBoxSongIDSearch();
|
||||
InitializeNumberSongIDButtons(pictureBoxSongIDSearch, NumberSongIDButton_Click);
|
||||
|
||||
InitializeInputBoxSongIDSearch();
|
||||
|
||||
InitializeSongIDButton();
|
||||
}
|
||||
|
||||
@ -96,13 +98,13 @@ namespace DualScreenDemo
|
||||
// 創建語音按鈕並設置其屬性
|
||||
numberSongIDButtonsForSongs[index] = new Button
|
||||
{
|
||||
Name = $"numberWordCountButton_{numberWordCountSymbols[index]}", // 按鈕名稱設為語音符號名稱
|
||||
Name = $"numberSongIDButtonsForSongs_{numberWordCountSymbols[index]}", // 按鈕名稱設為語音符號名稱
|
||||
};
|
||||
|
||||
ConfigureButton(numberSongIDButtonsForSongs[index], x, y, 72, 67,
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberWordCountButtonImages"][$"button{index}_normal"])),
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberWordCountButtonImages"][$"button{index}_mouseOver"])),
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberWordCountButtonImages"][$"button{index}_mouseDown"])),
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberSongIDButtonImages"][$"button{index}_normal"])),
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberSongIDButtonImages"][$"button{index}_mouseOver"])),
|
||||
new Bitmap(Path.Combine(serverPath, data["NumberSongIDButtonImages"][$"button{index}_mouseDown"])),
|
||||
handler);
|
||||
|
||||
// 設置按鈕的 Tag 屬性為對應的語音符號
|
||||
@ -139,7 +141,7 @@ namespace DualScreenDemo
|
||||
Name = "inputBoxSongIDSearch",
|
||||
ForeColor = Color.Black, // 設定文字顏色
|
||||
Font = new Font("Times New Roman", 26, FontStyle.Regular), // 設定字體樣式
|
||||
ScrollBars = RichTextBoxScrollBars.None // 不顯示滾動條
|
||||
ScrollBars = RichTextBoxScrollBars.None, // 不顯示滾動條
|
||||
};
|
||||
|
||||
// 調整和定位輸入框的位置及大小
|
||||
@ -224,6 +226,7 @@ namespace DualScreenDemo
|
||||
if (inputBoxSongIDSearch.Visible)
|
||||
{
|
||||
inputBoxSongIDSearch.Text += button.Tag.ToString();
|
||||
Console.WriteLine(inputBoxSongIDSearch.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,16 +248,7 @@ namespace DualScreenDemo
|
||||
}
|
||||
private void CloseButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxSongIDSearch.Visible = false;
|
||||
modifyButtonSongIDSearch.Visible = false;
|
||||
clearButtonSongIDSearch.Visible = false;
|
||||
closeButtonSongIDSearch.Visible = false;
|
||||
enterButtonSongIDSearch.Visible = false;
|
||||
inputBoxSongIDSearch.Visible = false;
|
||||
for (int i = 0; i <= 9; i++)
|
||||
{
|
||||
numberSongIDButtonsForSongs[i].Visible = false;
|
||||
}
|
||||
CloseUI(pictureBoxSongIDSearch);
|
||||
// 隱藏 SongID 歌手圖片框
|
||||
numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground;
|
||||
// 隱藏與 SongID 歌手相關的所有按鈕
|
||||
|
@ -10,7 +10,7 @@ namespace DualScreenDemo.Services
|
||||
private MediaPlayer _mediaPlayer;
|
||||
private Media? _media;
|
||||
private bool _disposed;
|
||||
|
||||
public bool _zero;
|
||||
public MediaService()
|
||||
{
|
||||
Core.Initialize();
|
||||
@ -80,14 +80,22 @@ namespace DualScreenDemo.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
_mediaPlayer.Stop();
|
||||
_mediaPlayer.Pause();
|
||||
|
||||
_media?.Dispose();
|
||||
_media = new Media(filePath, FromType.FromPath);
|
||||
|
||||
_media.ParseAsync(_libVLC);
|
||||
_media.ParsedChanged += (sender, args) =>
|
||||
{
|
||||
if (args.ParsedStatus != MediaParsedStatus.Failed)
|
||||
{
|
||||
_mediaPlayer.Media = addMediaOption(_media, audioTrackIndex);
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
};
|
||||
_mediaPlayer.Fullscreen = true;
|
||||
_mediaPlayer.Mute = false;
|
||||
// _mediaPlayer.Stopped += (s, e) => Console.WriteLine("Player Stopped");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -107,6 +115,7 @@ namespace DualScreenDemo.Services
|
||||
// media.AddOption(":clock-jitter=0");
|
||||
// media.AddOption(":clock-synchro=0");
|
||||
media.AddOption($":audio-track={audioTrackIndex}");
|
||||
if(_zero)media.AddOption(":no-audio");
|
||||
return media;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,7 @@ namespace DualScreenDemo
|
||||
this.Controls.Add(PrimaryForm.Instance.videoView1);
|
||||
PrimaryForm.Instance.videoView1.MediaPlayer = _mediaService1.Player;
|
||||
PrimaryForm.Instance.videoView0.MediaPlayer = _mediaService0.Player;
|
||||
_mediaService0._zero = true;
|
||||
PlayNextSong();
|
||||
}
|
||||
}
|
||||
@ -347,11 +348,9 @@ namespace DualScreenDemo
|
||||
{
|
||||
string pathToPlay = song.getFile();
|
||||
//同步畫面播放器載入media設置參數
|
||||
PrimaryForm.Instance.videoView0.Visible = false;
|
||||
_mediaService0.LoadMedia(pathToPlay, 0);
|
||||
_mediaService0.Player.Media.AddOption(":no-audio");
|
||||
// _mediaService0.Player.Media.AddOption(":no-audio");
|
||||
_mediaService0.Player.AspectRatio = "8:5";
|
||||
PrimaryForm.Instance.videoView0.Visible = true;
|
||||
//影片畫面播放器載入media設置聲道
|
||||
_mediaService1.LoadMedia(pathToPlay, song.isPublicSong ? 0 : 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user