mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-14 12:15:48 +02:00
Fix back button and context menu handling with a video playing
This commit is contained in:
parent
37d5efef1d
commit
8ceb70e67d
@ -398,7 +398,7 @@ protected override void WndProc(ref Message m){
|
||||
}
|
||||
}
|
||||
|
||||
if (isBrowserReady && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN){
|
||||
if (isBrowserReady && m.Msg == NativeMethods.WM_PARENTNOTIFY && (m.WParam.ToInt32() & 0xFFFF) == NativeMethods.WM_XBUTTONDOWN && !(videoPlayer?.Running ?? false)){
|
||||
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
||||
return;
|
||||
}
|
||||
@ -509,16 +509,16 @@ public void PlayNotificationSound(){
|
||||
}
|
||||
|
||||
public void PlayVideo(string url){
|
||||
if (string.IsNullOrEmpty(url)){
|
||||
videoPlayer?.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (videoPlayer == null){
|
||||
videoPlayer = new VideoPlayer(this);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(url)){
|
||||
videoPlayer.Launch(url);
|
||||
}
|
||||
else{
|
||||
videoPlayer.Close();
|
||||
}
|
||||
|
||||
videoPlayer.Launch(url);
|
||||
}
|
||||
|
||||
public void OnTweetScreenshotReady(string html, int width, int height){
|
||||
|
@ -8,6 +8,17 @@ namespace TweetDuck.Core.Other.Media{
|
||||
class VideoPlayer{
|
||||
private readonly string PlayerExe = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe");
|
||||
|
||||
public bool Running{
|
||||
get{
|
||||
if (currentProcess == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
currentProcess.Refresh();
|
||||
return !currentProcess.HasExited;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Form owner;
|
||||
private Process currentProcess;
|
||||
private string lastUrl;
|
||||
|
@ -791,7 +791,7 @@
|
||||
//
|
||||
(function(){
|
||||
var playVideo = function(url){
|
||||
$('<div class="ovl" style="display:block"></div>').click(function(){
|
||||
$('<div class="ovl" style="display:block"></div>').on("click contextmenu", function(){
|
||||
$TD.playVideo(null);
|
||||
$(this).remove();
|
||||
}).appendTo(app);
|
||||
|
Loading…
Reference in New Issue
Block a user