Code: Select all
using LibVLCSharp.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TestApp
{
class Program
{
static void Main(string[] args)
{
Core.Initialize();
var vlcArgs = new List<string>();
vlcArgs.Add("--swscale-mode=4");
var libvlc = new LibVLC(vlcArgs.ToArray());
var player = new MediaPlayer(libvlc);
var media = new Media(libvlc, "./wills_30_second.ts", FromType.FromPath);
player.Play(media);
Thread.Sleep(100);
var audio = player.AudioTrackDescription;
foreach (var track in audio)
{
Console.WriteLine($"Name {track.Name}, Id {track.Id}");
}
player.Media.Parse();
var mediaTracks = player.Media.Tracks;
var audioTracks = mediaTracks.Where(track => track.TrackType == TrackType.Audio);
foreach (var audioTrack in audioTracks)
{
Console.WriteLine($"Description {audioTrack.Description}, Id {audioTrack.Id}");
}
Console.WriteLine("how do I tie these together?");
Console.ReadLine();
}
}
}
C# framework 4.7.2, LibVlcSharp 3.6.5 and VideoLAN.LibVlc.Windows 3.0.18. Williing to provide a zip file if granted attachment permissions