### LibVLC Media Player Initialization (C#)
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/linux-setup.md
Example of initializing LibVLC and a MediaPlayer in C#. Ensure libvlc libraries are accessible via LD_LIBRARY_PATH if not in the default location.
```csharp
// initialize multithreading support
ImportHelper.Native.XInitThreads();
// player initialization
using var libvlc = new LibVLC(enableDebugLogs: true);
using var media = new Media(libvlc, new Uri(@"C:\\tmp\\big_buck_bunny.mp4"));
using var mediaplayer = new MediaPlayer(media);
mediaplayer.Play();
Console.ReadKey();
```
--------------------------------
### Basic Media Playback with LibVLCSharp
Source: https://github.com/videolan/libvlcsharp/blob/3.x/README.md
This snippet demonstrates the fundamental steps to initialize LibVLC, load a media file, and start playback. Ensure the media file path is correct.
```csharp
using var libvlc = new LibVLC(enableDebugLogs: true);
using var media = new Media(libvlc, new Uri(@"C:\\tmp\\big_buck_bunny.mp4"));
using var mediaplayer = new MediaPlayer(media);
mediaplayer.Play();
Console.ReadKey();
```
--------------------------------
### Install LibVLC Windows NuGet Package
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/migrating_from_Vlc.DotNet.md
Installs the Windows version of LibVLC 3.0.10 using the dotnet CLI. This is the recommended way to manage libVLC dependencies for .NET applications.
```bash
dotnet add package VideoLAN.LibVLC.Windows --version 3.0.10
```
--------------------------------
### Basic Media Playback with LibVLCSharp
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/migrating_from_Vlc.DotNet.md
This example demonstrates basic media playback using LibVLCSharp, including setting up LibVLC and MediaPlayer, specifying output options for saving to a file, and handling playback events like position changes, errors, and end of playback.
```csharp
using System;
using System.IO;
using System.Threading;
namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
using var libvlc = new LibVLC();
using var mediaPlayer = new MediaPlayer(libvlc);
var mediaOptions = new string[]
{
":sout=#file{dst="+Path.Combine(Environment.CurrentDirectory, "output.mov")+"}",
":sout-keep"
};
mediaPlayer.Media = new Media(new Uri("http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov"), mediaOptions);
bool playFinished = false;
mediaPlayer.PositionChanged += (sender, e) =>
{
Console.Write("\r" + Math.Floor(e.Position * 100) + "%");
};
mediaPlayer.EncounteredError += (sender, e) =>
{
Console.Error.Write("An error occurred");
playFinished = true;
};
mediaPlayer.EndReached += (sender, e) => {
playFinished = true;
};
mediaPlayer.Play();
await Task.Delay(TimeSpan.FromMilliseconds(500));
}
}
}
```
--------------------------------
### Android Resource Structure Example
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/Platforms/Android/Resources/AboutResources.txt
Illustrates the typical directory structure for Android resources within an application. Resources are organized into subdirectories like drawable, layout, and values.
```plaintext
Resources/
drawable/
icon.png
layout/
main.axml
values/
strings.xml
```
--------------------------------
### Add Preview NuGet Feed
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/libvlc_preview.md
Configure your NuGet package sources to include the LibVLC preview feed. This allows your project to discover and install pre-release versions of LibVLCSharp and related packages.
```xml
```
--------------------------------
### Get iOS Device Name
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/readme.md
Provides commands to retrieve the device name (UDID) required for running the iOS sample.
```bash
instruments -s devices
```
```bash
xcrun simctl list
```
```bash
From Xcode: Window -> Devices and Simulators -> Simulators. The Identifier value is the UDID.
```
--------------------------------
### Get Video Dimensions
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Retrieve the current width and height of the video player. Be mindful of video orientation, as width and height may need to be swapped.
```csharp
uint videoHeight = 0;
uint videoWidth = 0;
mediaPlayer.Size(0, ref videoWidth, ref videoHeight);
```
--------------------------------
### Android Resource Class Structure
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Forms/LibVLCSharp.Forms.MediaElement/LibVLCSharp.Forms.Sample.MediaElement.Android/Resources/AboutResources.txt
This is an example of the 'Resource' class generated by the Android build system. It contains nested classes for different resource types (drawable, layout, strings) with constants representing their IDs.
```csharp
public class Resource {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
```
--------------------------------
### Change Subtitle Encoding
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Specify the character encoding for subtitles using the `:subsdec-encoding` media option. For example, use `Windows-1252` for compatibility with certain subtitle files.
```csharp
media.AddOption(":subsdec-encoding=Windows-1252");
```
--------------------------------
### Vlc.DotNet Media Player Initialization and Playback
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/migrating_from_Vlc.DotNet.md
Demonstrates how to initialize and use Vlc.DotNet's MediaPlayer for playing media, including setting output options and handling playback events. Requires manual specification of the libvlc directory.
```csharp
using System;
using System.IO;
using System.Threading;
namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
var libDirectory = new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
var options = new string[]
{
// VLC options can be given here. Please refer to the VLC command line documentation.
};
var mediaPlayer = new Vlc.DotNet.Core.VlcMediaPlayer(libDirectory);
var mediaOptions = new string[]
{
":sout=#file{dst="+Path.Combine(Environment.CurrentDirectory, "output.mov")+"}",
":sout-keep"
};
mediaPlayer.SetMedia(new Uri("http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov"), mediaOptions);
bool playFinished = false;
mediaPlayer.PositionChanged += (sender, e) =>
{
Console.Write("\r" + Math.Floor(e.NewPosition * 100) + "%");
};
mediaPlayer.EncounteredError += (sender, e) =>
{
Console.Error.Write("An error occurred");
playFinished = true;
};
mediaPlayer.EndReached += (sender, e) => {
playFinished = true;
};
mediaPlayer.Play();
await Task.Delay(TimeSpan.FromMilliseconds(500));
}
}
}
```
--------------------------------
### Build and Run iOS Sample
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/readme.md
Builds and runs the iOS sample targeting a specific runtime identifier and device name. Replace 'xxx' with your actual device name.
```bash
dotnet build -t:Run -f net9.0-ios -p:RuntimeIdentifier=ios-arm64 -p:_DeviceName=xxx
```
--------------------------------
### UWP LibVLC Initialization with SwapChainOptions
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/getting_started.md
For UWP applications, initialize LibVLC with swap chain options obtained from the VideoView's Initialized event. This is necessary for DirectX output.
```csharp
new LibVLC(eventArgs.SwapChainOptions);
```
--------------------------------
### Initialize LibVLC with Constructor Options
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Set advanced LibVLC options during initialization using the constructor. Multiple arguments can be passed as separate strings or combined.
```csharp
using var libvlc = new LibVLC("--verbose=2");
```
```csharp
using var libvlc = new LibVLC("--verbose", "2");
```
--------------------------------
### Load Raw Asset using Essentials
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/LibVLCSharp.MAUI.Sample/Resources/Raw/AboutAssets.txt
Demonstrates how to load a raw asset file deployed with the application package using the FileSystem.OpenAppPackageFileAsync method. This is useful for accessing configuration files, media, or other resources.
```csharp
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}
```
--------------------------------
### Play YouTube Video with LibVLCSharp
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Play a YouTube video by providing its URL to the `Media` constructor and parsing it with network options. Ensure to select the correct media sub-item if available.
```csharp
using(var libVLC = new LibVLC())
{
var media = new Media(libVLC, "https://www.youtube.com/watch?v=dQw4w9WgXcQ", FromType.FromLocation);
await media.Parse(MediaParseOptions.ParseNetwork);
using (var mp = new MediaPlayer(media.SubItems.First()))
{
var r = mp.Play();
Console.ReadKey();
}
}
```
--------------------------------
### Asset File Naming Conventions
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/Assets/SharedAssets.md
Illustrates common naming conventions for image assets to support different scales in Uno Platform projects. Ensure files are placed in the Assets directory and have the correct build action set to Content.
```text
\Assets\Images\logo.scale-100.png
\Assets\Images\logo.scale-200.png
\Assets\Images\logo.scale-400.png
\Assets\Images\scale-100\logo.png
\Assets\Images\scale-200\logo.png
\Assets\Images\scale-400\logo.png
```
--------------------------------
### Enable Loopback Playback
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Configure LibVLC to repeat playback using the `--input-repeat` option when initializing `LibVLC`. The value specifies the number of times to repeat.
```csharp
new LibVLC("--input-repeat=2")
```
--------------------------------
### Add LibVLC Platform Package
Source: https://github.com/videolan/libvlcsharp/blob/3.x/README.md
Use this command to add the appropriate LibVLC native library package for your target platform. Replace the placeholder with your specific platform identifier.
```cmd
dotnet add package VideoLAN.LibVLC.[Windows|UWP|Android|iOS|Mac|tvOS]
```
--------------------------------
### Initialize X Window System Threads (C#)
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/linux-setup.md
Use this C# code to initialize the X Window System for multithreading support on Linux. This is often required when using the X Window System.
```csharp
using System.Runtime.InteropServices;
namespace myApp;
public static class ImportHelper
{
public struct Native
{
///
/// Initializes the X threading system
///
/// Linux X11 only
/// non-zero on success, zero on failure
[DllImport("libX11", CallingConvention = CallingConvention.Cdecl)]
public static extern int XInitThreads();
}
}
```
--------------------------------
### Include Raw Assets in .csproj
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/LibVLCSharp.MAUI.Sample/Resources/Raw/AboutAssets.txt
This build action ensures that all files in the Resources\Raw directory and its subdirectories are included as MauiAssets. The LogicalName ensures they are deployed with the correct relative path.
```xml
```
--------------------------------
### Initialize LibVLCSharp.Forms Renderer for iOS
Source: https://github.com/videolan/libvlcsharp/blob/3.x/src/LibVLCSharp.Forms/README.md
In your iOS project, override FinishedLaunching in AppDelegate.cs to initialize the LibVLCSharpFormsRenderer. This is necessary for the platform-specific renderers to work correctly.
```csharp
using Foundation;
using LibVLCSharp.Forms.Platforms.iOS;
using LibVLCSharp.Forms.Shared;
using ObjCRuntime;
using UIKit;
// ...
namespace MyAppNameSpace.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
LibVLCSharpFormsRenderer.Init();
// ...
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, [Transient] UIWindow forWindow)
{
return OrientationChangeListener.Subscribe(this);
}
}
}
```
--------------------------------
### Configure Deblocking Filter Settings
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Initialize LibVLC with the `--avcodec-skiploopfilter` option to control the deblocking filter. This can improve decoding speed at the cost of quality. The value determines the level of filtering applied.
```csharp
new LibVLC("--avcodec-skiploopfilter=2")
```
--------------------------------
### Generate LibVLC plugin cache
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/best_practices.md
For faster initialization, generate a plugin cache by running the application once with the '--reset-plugins-cache' argument. This creates a 'plugins.dat' file for quicker plugin loading.
```csharp
new LibVLC("--reset-plugins-cache");
```
--------------------------------
### Add Advanced Options to Media
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Use the Media.AddOption method to apply advanced LibVLC options to a specific media object. Note that some options may only work with the constructor.
```csharp
media.AddOption(":no-audio");
```
--------------------------------
### Standard Grid Layout with VideoView and Button
Source: https://github.com/videolan/libvlcsharp/blob/3.x/src/LibVLCSharp.Avalonia/README.md
This XAML demonstrates a typical layout in other platforms where a button is placed over a VideoView using a parent Grid.
```xml
```
--------------------------------
### Enable LibVLC Debug Logs
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/troubleshooting.md
Enable verbose libVLC logs by passing `enableDebugLogs: true` when creating the LibVLC object. Logs are printed to the console or Visual Studio Output Window. You can also subscribe to log messages via `libvlc.Log += ...`.
```csharp
new LibVLC(enableDebugLogs: true);
```
--------------------------------
### Accessing Raw Assets in Android
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Forms/LibVLCSharp.Forms.MediaElement/LibVLCSharp.Forms.Sample.MediaElement.Android/Assets/AboutAssets.txt
Place raw assets in the Assets directory and set their Build Action to "AndroidAsset". Access them using Android's AssetManager.
```csharp
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
```
--------------------------------
### WPF VideoView with Overlay Content
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/getting_started.md
Use this pattern to place content over the video in WPF applications. The content inside the VideoView is rendered in a separate transparent window on top of the video.
```xml
This content will be rendered over the video
```
--------------------------------
### Accessing Android Assets
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/Platforms/Android/Assets/AboutAssets.txt
Demonstrates how to open and read raw asset files deployed with your Android application using the AssetManager.
```csharp
public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
InputStream input = Assets.Open ("my_asset.txt");
}
}
```
--------------------------------
### WPF VideoView Context Menu and Mouse Events
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/getting_started.md
To enable context menus and mouse-click events on WPF's VideoView, a Grid with a minimally transparent background must be added inside the VideoView. Ensure the background alpha is greater than 0.
```xml
```
--------------------------------
### Configure R8 for LibVLCSharp on Android
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/android.md
Add these lines to your 'r8.cfg' file to prevent R8 from removing or obfuscating LibVLCSharp classes. This is crucial for the correct functioning of the library on Android.
```proguard
-keep class org.videolan.** { *; }
-dontwarn org.videolan.**
```
--------------------------------
### Set Subtitles for Media Playback
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Add subtitle tracks to a media player using `MediaPlayer.AddSlave`. Specify the slave type as `MediaSlaveType.Subtitle`, provide the file path, and indicate if it's the default track.
```csharp
using(var libVLC = new LibVLC())
{
var media = new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation);
using (var mp = new MediaPlayer(media))
{
mp.AddSlave(MediaSlaveType.Subtitle, "file:///C:\\Users\\Me\\Desktop\\subs.srt", true);
var r = mp.Play();
Console.ReadKey();
}
}
```
--------------------------------
### Dispose LibVLCSharp objects
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/best_practices.md
LibVLCSharp objects implement IDisposable and require manual disposal. Always call Dispose() or use a 'using' statement to release native resources.
```csharp
using (var mediaPlayer = new MediaPlayer(libVlc))
{
// Use mediaPlayer here
}
```
--------------------------------
### Retrieve Video/Audio/Subtitle Track Information
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Iterate through media tracks to access specific details for audio and video types. Ensure media is parsed with network options if streaming.
```csharp
using var libVLC = new LibVLC();
using var media = new Media(libVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"));
await media.Parse(MediaParseOptions.ParseNetwork);
foreach(var track in media.Tracks)
{
switch(track.TrackType)
{
case TrackType.Audio:
Debug.WriteLine("Audio track");
Debug.WriteLine($"{nameof(track.Data.Audio.Channels)}: {track.Data.Audio.Channels}");
Debug.WriteLine($"{nameof(track.Data.Audio.Rate)}: {track.Data.Audio.Rate}");
break;
case TrackType.Video:
Debug.WriteLine("Video track");
Debug.WriteLine($"{nameof(track.Data.Video.FrameRateNum)}: {track.Data.Video.FrameRateNum}");
Debug.WriteLine($"{nameof(track.Data.Video.FrameRateDen)}: {track.Data.Video.FrameRateDen}");
Debug.WriteLine($"{nameof(track.Data.Video.Height)}: {track.Data.Video.Height}");
Debug.WriteLine($"{nameof(track.Data.Video.Width)}: {track.Data.Video.Width}");
break;
}
}
```
--------------------------------
### Take a Snapshot of the Video
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Capture a still image from the video using the `MediaPlayer.TakeSnapshot` method. Specify the snapshot number, file path, and desired width and height.
```csharp
MediaPlayer.TakeSnapshot(uint num, string? filePath, uint width, uint height)
```
--------------------------------
### Push branch to GitHub
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
Push your newly created branch to your GitHub repository to make it available for a pull request.
```shell
git push origin my-fix-branch
```
--------------------------------
### Loading Custom Fonts from Assets
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Forms/LibVLCSharp.Forms.MediaElement/LibVLCSharp.Forms.Sample.MediaElement.Android/Assets/AboutAssets.txt
Custom fonts can be loaded directly from the assets folder using Typeface.CreateFromAsset.
```csharp
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
```
--------------------------------
### Enable Hardware Decoding in MediaPlayer
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Set the `EnableHardwareDecoding` property to `true` to utilize hardware acceleration for decoding media. This can improve performance for compatible hardware and codecs.
```csharp
MediaPlayer.EnableHardwareDecoding = true
```
--------------------------------
### Avalonia Grid Layout with Overlay Content
Source: https://github.com/videolan/libvlcsharp/blob/3.x/src/LibVLCSharp.Avalonia/README.md
This XAML shows the Avalonia-specific approach where overlay content, like a Button, is placed directly inside the VideoView element, leveraging its container-like behavior.
```xml
```
--------------------------------
### Enable Marquee Display
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Use this option to enable or disable the marquee display on the video. A value of 1 enables it, and 0 disables it.
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Enable, 1);
```
--------------------------------
### Handle LibVLC events on a separate thread
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/best_practices.md
Avoid calling LibVLC methods directly from event handlers to prevent application freezes. Use ThreadPool.QueueUserWorkItem or similar mechanisms to switch to a background thread.
```csharp
mediaPlayer.EndReached += (sender, args) => mediaPlayer.Play(nextMedia);
// Corrected version:
mediaPlayer.EndReached += (sender, args) => ThreadPool.QueueUserWorkItem(_ => mediaPlayer.Play(nextMedia));
```
--------------------------------
### Commit changes
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
Commit your changes using a descriptive message. The `-a` option automatically stages modified files.
```shell
git commit -a
```
--------------------------------
### Create a new git branch
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
Before submitting a pull request, create a new git branch for your changes. This helps keep your work isolated and organized.
```shell
git checkout -b my-fix-branch develop
```
--------------------------------
### Avoid creating multiple LibVLC instances
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/best_practices.md
Only create a single instance of LibVLC throughout your application's lifecycle. You can create multiple MediaPlayer objects from one LibVLC instance.
```csharp
var libVlc = new LibVLC();
var mediaPlayer = new MediaPlayer(libVlc);
```
--------------------------------
### Add Constructor to Generated Class
Source: https://github.com/videolan/libvlcsharp/blob/3.x/src/LibVLCSharp.Android.AWindowModern/Additions/AboutAdditions.txt
Extend a generated partial class with a new constructor that accepts custom C# types. This allows for more convenient initialization of objects.
```csharp
public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}
```
--------------------------------
### Set Marquee Text
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Specify the text content to be displayed as the marquee.
```csharp
MediaPlayer.SetMarqueeString(VideoMarqueeOption.Text, "my text"); //Text to display
```
--------------------------------
### Generated R Class for Android Resources
Source: https://github.com/videolan/libvlcsharp/blob/3.x/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/Platforms/Android/Resources/AboutResources.txt
Shows a C# representation of the 'R' class generated by the Android build system. This class contains static tokens for accessing various resource types, such as drawables, layouts, and strings.
```csharp
public class R {
public class drawable {
public const int icon = 0x123;
}
public class layout {
public const int main = 0x456;
}
public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}
```
--------------------------------
### Define a New C# Class
Source: https://github.com/videolan/libvlcsharp/blob/3.x/src/LibVLCSharp.Android.AWindowModern/Additions/AboutAdditions.txt
Introduce a new, fully managed C# class to the binding library. This class does not need to interact with Java or native code and can be used like any other C# class.
```csharp
public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
```
--------------------------------
### Set Marquee Opacity
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Control the opacity of the marquee text. The value should be between 0 (transparent) and 255 (fully opaque). The default is 255.
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Opacity, 100);
```
--------------------------------
### Rebase and force push to update PR
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
If your pull request becomes outdated, you may need to rebase your branch onto the target branch and force push to update the pull request.
```shell
git rebase target_branch -i
git push origin my-fix-branch -f
```
--------------------------------
### Set Marquee Font Size
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Configure the font size of the marquee text in pixels. The default value is 0.
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Size, 32);
```
--------------------------------
### Change Movie Play Rate
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Control the playback speed of a video by calling the `MediaPlayer.SetRate` method with a `float` value representing the desired rate.
```csharp
MediaPlayer.SetRate(float rate)
```
--------------------------------
### Set Marquee X and Y Axis Offsets
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Adjust the horizontal (X) and vertical (Y) offsets for the marquee text. The default values for both are 0.
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.X, 50); //X offset, from the left screen edge. default_value=0
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Y, 90); //Y offset, down from the top. default_value=0
```
--------------------------------
### Update local master with upstream changes
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
After cleaning up your local branches, update your local master branch with the latest changes from the upstream repository.
```shell
git pull --ff upstream master
```
--------------------------------
### Set Marquee Position
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Set the position of the marquee text. Values like 0 (center), 1 (left), 2 (right), 4 (top), and 8 (bottom) can be used individually or combined.
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Position, 8);
```
--------------------------------
### Change Subtitle Font Size
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Adjust the relative font size for subtitles using the `:freetype-rel-fontsize` media option. Common values include 10, 13, 16, or 19.
```csharp
media.AddOption(":freetype-rel-fontsize=10"); // Usually 10, 13, 16 or 19
```
--------------------------------
### Set Marquee Color
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Set the color of the marquee text using a decimal representation. The default color is white (16777215).
```csharp
MediaPlayer.SetMarqueeInt(VideoMarqueeOption.Color, 16711680); // red
```
--------------------------------
### Change Subtitle Color
Source: https://github.com/videolan/libvlcsharp/blob/3.x/docs/how_do_I_do_X.md
Set the subtitle color using the `:freetype-color` media option. The color is specified as an integer representing an RGB value (e.g., 16711680 for red).
```csharp
media.AddOption(":freetype-color=16711680"); // Red
```
--------------------------------
### Delete local branch
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
Once the remote branch is deleted, you can also delete the local branch.
```shell
git branch -D my-fix-branch
```
--------------------------------
### Delete remote branch
Source: https://github.com/videolan/libvlcsharp/blob/3.x/CONTRIBUTING.md
After your pull request is merged, you can delete the remote branch from GitHub through the web UI or your local shell.
```shell
git push origin --delete my-fix-branch
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.