Reading timecode track data using the C# version of Quicktime - c#

I'm using the .Net activeX component of Quicktime.
I would like to read the timecode track data contained in a QTMovie track.
I can already select my timecode track like this :
// Valid Quicktime movie
QTMovie movie;
QTUtils qtu = new QTUtils();
for (int i = 1; i <= movie.Tracks.Count; i++)
{
if (movie.Tracks[i].Type == qtu.StringToFourCharCode("tmcd"))
{
QTTrack tcTrack = movie.Tracks[i];
//
// Timecode data reading ?
//
}
Is there a way to extract the timecode data?
Thank you for your help!

I asked a very similar question regarding applescript and timecode. The workaround was to use another app, an open source, command line app called timecodereader available here. I'm not sure if it's cross platform, but you might be able to glean something from the sourc code.
HTH

Related

What is the alternative to java Keys.chord() method in C#?

I am new to C# & not able to delete some textbox content using Selenium Clear command. In such situation I was trying the below command when I was working in Java.
webelement.sendKeys(Keys.chord(Keys.CONTROL,"a", Keys.DELETE));
Now in C#, the chord command is not available.
I have gone through the Keys class please find the link https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/Keys.html and believe chord is not there for C#. Do we have any alternative to perform the same operation. I am able to delete the inputs from textbox using JavaScript but how can I achieve pressing many keys at once in C#.
Currently using this approach using JavaScript
public static void clearTextboxContentUsingJS(IWebDriver driver, IWebElement element)
{
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].value ='';", element);
}
You could try pressing Keys.Backspace in a loop and see if that helps.
var length = element.GetAttribute("value").Length;
for (int i = 0; i < length; i++)
{
webElement.SendKeys(Keys.Backspace);
Thread.Sleep(100);
}
Also, I know you have tried Keys.CONTROL + "a" + Keys.DELETE. I have tried this solution in the past, but split onto separate lines, so that may be worth trying as well:
webElement.SendKeys(Keys.Control + "a");
webElement.SendKeys(Keys.Delete);

What is the proper way of using the Windows.Media.Miracast namespace?

I am looking into screen casting through Miracast in an application but am unsure of how to use the Windows.Media.Miracast namespace. Limited information exists on the internet due to the short age of the Windows 10 1903 update that the namespace comes as a part of.
The only thing I've found so far is this documentation.
My question is does anybody know what the proper way of using this namespace is? Any examples or resources found online would be a great help.
Cheers.
These three sample projects demonstrate various MiraCast source apis that can be used from UWP applications. Not sure about outside UWP.
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BasicMediaCasting
https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/AdvancedCasting
https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/Projection
I'm personally using code like the following, on Windows IoT Core, to cast my whole screen
Scan for devices:
miraDeviceWatcher = DeviceInformation.CreateWatcher(CastingDevice.GetDeviceSelector(CastingPlaybackTypes.Video));
miraHandlerAdded = new TypedEventHandler<DeviceWatcher, DeviceInformation>(async (watcher, deviceInfo) =>
{
await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
//Add each discovered device to our listbox
CastingDevice addedDevice = await CastingDevice.FromIdAsync(deviceInfo.Id);
var disp = new CastingDisplay(addedDevice); //my viewmodel
MiraDevices.Add(disp); //ObservableCollection
});
});
miraDeviceWatcher.Added += miraHandlerAdded;
Connect to selected device:
public async Task StartCasting(CastingDisplay castee)
{
//When a device is selected, first thing we do is stop the watcher so it's search doesn't conflict with streaming
if (miraDeviceWatcher.Status != DeviceWatcherStatus.Stopped)
{
miraDeviceWatcher.Stop();
}
//Create a new casting connection to the device that's been selected
connection = castee.Device.CreateCastingConnection();
//Register for events
connection.ErrorOccurred += Connection_ErrorOccurred;
connection.StateChanged += Connection_StateChangedAsync;
var image = new Windows.UI.Xaml.Controls.Image();
await connection.RequestStartCastingAsync(image.GetAsCastingSource());
}
This Image is just used as a casting source. Once the connection is made, my whole screen is broadcast. The behavior is not documented. Hopefully it won't get 'fixed' in a future update.

C# How to access the current playback of windows

at Windows 10 there is a Music Feature(Pic Below):
So my Question is: How can I access this information with C# and which libraries do i need?
Thanks for helping
Excuse me for my ignorance, but if I am correct, this widget is a pop up of Spotify, isn't this? In that case, you only have to check the MainWindowsTitle of spotify process.
var spotify = Process.GetProcessesByName("Spotify");
foreach (var song in spotify)
{
Console.WriteLine(song.MainWindowTitle);
}
Console.ReadLine();
Don't forget use using System.Diagnostics;. You will have to check if you don't get any song.
I was checking if this method works yet :)

How to get all changes to a file in Git, with Lib2GitSharp

I want to be able to Get a list of all changes done to a file. I've seen this post
How to get file's contents on Git using LibGit2Sharp?, but this requires to start off with a commit. I want to start digging with the filename.
Also is this possible without getting the whole repo locally?
After a bit of research I think I found an answer.
/*Small test*/
using (Repository repo = new Repository(strLocalDeliveryPath))
{
var fileHistory = repo.Commits.QueryBy(#"Path/To/file.ini").ToList();
int i = fileHistory.Count();
}
This is in order newest to oldest, and that suits me fine. I would normally only need the latest version of the file content, but nor i have the option of digging through the history of the file.
You can see this answer for a bit more info, but yes, the functionality was added in libgit2sharp 0.22.0. Here's an example:
var fileHistory = repository.Commits.QueryBy(filePathRelativeToRepository);
foreach (var version in fileHistory)
{
// Get further details by inspecting version.Commit
}

c# API to use wordnet-what is better?

I am doing a web based chattebot system and my problems are these.
I need to get a particular user question and check for some specific keywords in it(for example take the nouns) and find for synonyms and well as do the spell check?
Therefore What is the best C# API for wordnet??
Well what I want to do is get a sentence from a textbox and use it for synonym and spell check and there is both c# ASP and standalone app APIs on the wrodnet site.What is the best way?
Can I do both spell check and synonym check using wordnet and the other c# API??
I would be grateful if you could give me some solutions.
Thanks a lot.
If you can I would use the WPF built in spell checker, just add a reference to PresentationFramework in your ASP.NET project and you can programmatically create a WPF text box to use for spell check etc.
List<string> getSuggestions(string text)
{
System.Windows.Controls.TextBox wpfTextBox = new System.Windows.Controls.TextBox();
wpfTextBox.AcceptsReturn = true;
wpfTextBox.AcceptsTab = true;
wpfTextBox.SpellCheck.IsEnabled = true;
wpfTextBox.Text = text;
int index = 0;
List<string> suggestions = new List<string>();
while ((index = wpfTextBox.GetNextSpellingErrorCharacterIndex(index, System.Windows.Documents.LogicalDirection.Forward)) != -1)
{
string currentError = wpfTextBox.Text.Substring(index, wpfTextBox.GetSpellingErrorLength(index));
suggestions.Add(currentError);
foreach (string suggestion in wpfTextBox.GetSpellingError(index).Suggestions)
{
suggestions.Add(suggestion);
}
}
return suggestions;
}
Of the API's listed here: http://wordnet.princeton.edu/wordnet/related-projects/#.NET,
Matt Gerber's ( http://ptl.sys.virginia.edu/ptl/members/matthew-gerber/software#WordNet_API ) is the best.
It's not a great API, but it works okay and it was a good start for what I needed.
I've also not tried Proxem's Antelope yet as it seemed more like a heavyweight app then a simple API. It may be much more robust though, and the parsing engine could be very useful for what you are doing.

Categories