mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-18 15: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);
|
browser.ExecuteScriptAsync("TDGF_onMouseClickExtra", (m.WParam.ToInt32() >> 16) & 0xFFFF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -509,16 +509,16 @@ public void PlayNotificationSound(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void PlayVideo(string url){
|
public void PlayVideo(string url){
|
||||||
|
if (string.IsNullOrEmpty(url)){
|
||||||
|
videoPlayer?.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (videoPlayer == null){
|
if (videoPlayer == null){
|
||||||
videoPlayer = new VideoPlayer(this);
|
videoPlayer = new VideoPlayer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(url)){
|
videoPlayer.Launch(url);
|
||||||
videoPlayer.Launch(url);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
videoPlayer.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnTweetScreenshotReady(string html, int width, int height){
|
public void OnTweetScreenshotReady(string html, int width, int height){
|
||||||
|
@ -8,6 +8,17 @@ namespace TweetDuck.Core.Other.Media{
|
|||||||
class VideoPlayer{
|
class VideoPlayer{
|
||||||
private readonly string PlayerExe = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe");
|
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 readonly Form owner;
|
||||||
private Process currentProcess;
|
private Process currentProcess;
|
||||||
private string lastUrl;
|
private string lastUrl;
|
||||||
|
@ -791,7 +791,7 @@
|
|||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var playVideo = function(url){
|
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);
|
$TD.playVideo(null);
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}).appendTo(app);
|
}).appendTo(app);
|
||||||
|
Loading…
Reference in New Issue
Block a user