mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-05 02:34:07 +02:00
Change video play icon color and handle playback errors
This commit is contained in:
parent
58cc7ea10d
commit
924065c26e
@ -2,6 +2,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Other.Media{
|
namespace TweetDuck.Core.Other.Media{
|
||||||
class VideoPlayer{
|
class VideoPlayer{
|
||||||
@ -9,6 +10,7 @@ class VideoPlayer{
|
|||||||
|
|
||||||
private readonly Form owner;
|
private readonly Form owner;
|
||||||
private Process currentProcess;
|
private Process currentProcess;
|
||||||
|
private string lastUrl;
|
||||||
|
|
||||||
public VideoPlayer(Form owner){
|
public VideoPlayer(Form owner){
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@ -17,6 +19,8 @@ public VideoPlayer(Form owner){
|
|||||||
public void Launch(string url){
|
public void Launch(string url){
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
|
lastUrl = url;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if ((currentProcess = Process.Start(new ProcessStartInfo{
|
if ((currentProcess = Process.Start(new ProcessStartInfo{
|
||||||
FileName = PlayerExe,
|
FileName = PlayerExe,
|
||||||
@ -55,11 +59,14 @@ public void Close(){
|
|||||||
private void process_Exited(object sender, EventArgs e){
|
private void process_Exited(object sender, EventArgs e){
|
||||||
switch(currentProcess.ExitCode){
|
switch(currentProcess.ExitCode){
|
||||||
case 2: // CODE_LAUNCH_FAIL
|
case 2: // CODE_LAUNCH_FAIL
|
||||||
// TODO
|
if (FormMessage.Error("Video Playback Error", "Error launching video player, this may be caused by missing Windows Media Player. Do you want to open the video in a browser?", FormMessage.Yes, FormMessage.No)){
|
||||||
|
BrowserUtils.OpenExternalBrowser(lastUrl);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // CODE_MEDIA_ERROR
|
case 3: // CODE_MEDIA_ERROR
|
||||||
// TODO
|
FormMessage.Error("Video Playback Error", "The video could not be loaded or rendered correctly.", FormMessage.OK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -714,6 +714,7 @@
|
|||||||
addRule(".keyboard-shortcut-list { vertical-align: top; }"); // fix keyboard navigation alignment
|
addRule(".keyboard-shortcut-list { vertical-align: top; }"); // fix keyboard navigation alignment
|
||||||
addRule(".account-inline .username { vertical-align: 10%; }"); // move usernames a bit higher
|
addRule(".account-inline .username { vertical-align: 10%; }"); // move usernames a bit higher
|
||||||
addRule(".character-count-compose { width: 40px !important; }"); // fix strangely wide character count element
|
addRule(".character-count-compose { width: 40px !important; }"); // fix strangely wide character count element
|
||||||
|
addRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #9f51cf; }"); // change play icon on mp4s
|
||||||
|
|
||||||
addRule(".column-nav-link .attribution { position: absolute; }"); // fix cut off account names
|
addRule(".column-nav-link .attribution { position: absolute; }"); // fix cut off account names
|
||||||
addRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }"); // fix cut off badge icon when zoomed in
|
addRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }"); // fix cut off badge icon when zoomed in
|
||||||
@ -758,9 +759,6 @@
|
|||||||
addRule(".js-column-header .column-header-link { padding: 0; }"); // fix column header tooltip hover box
|
addRule(".js-column-header .column-header-link { padding: 0; }"); // fix column header tooltip hover box
|
||||||
addRule(".js-column-header .column-header-link .icon { padding: 9px 4px; width: calc(1em + 8px); height: 100%; box-sizing: border-box; }"); // fix column header tooltip hover box
|
addRule(".js-column-header .column-header-link .icon { padding: 9px 4px; width: calc(1em + 8px); height: 100%; box-sizing: border-box; }"); // fix column header tooltip hover box
|
||||||
|
|
||||||
addRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }"); // change cursor on unsupported videos
|
|
||||||
addRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }"); // change play icon color on unsupported videos
|
|
||||||
|
|
||||||
window.TDGF_reinjectCustomCSS = function(styles){
|
window.TDGF_reinjectCustomCSS = function(styles){
|
||||||
$("#tweetduck-custom-css").remove();
|
$("#tweetduck-custom-css").remove();
|
||||||
|
|
||||||
@ -826,15 +824,7 @@
|
|||||||
let media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
let media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
||||||
|
|
||||||
if (media && media.isVideo && media.service !== "youtube"){
|
if (media && media.isVideo && media.service !== "youtube"){
|
||||||
let data = media.chooseVideoVariant();
|
playVideo(media.chooseVideoVariant().url);
|
||||||
|
|
||||||
if (data.content_type === "video/mp4"){
|
|
||||||
playVideo(data.url);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$TD.openBrowser(this.clickedLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelModal = true;
|
cancelModal = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user