Page 1 of 1
[C#] Chromecast stream from local IP camera
Posted: 10 Dec 2019 17:39
by Bakineo
Hello !
I want to get a live stream from my local IP camera on a chromecast through a C# application.
I didn't succeed to do that with libVLCsharp, I only found a sample for Android and iOS but my application is for Windows (not Windows Phone)
Can anybody tell me how can I do please ?
Thanks in advance !
Re: [C#] Chromecast stream from local IP camera
Posted: 11 Dec 2019 03:17
by mfkl
Hi,
What have you tried? Can you share your code?
It should work the same way as the Android sample.
Re: [C#] Chromecast stream from local IP camera
Posted: 11 Dec 2019 11:12
by Bakineo
Hi,
I tried to implement the libVLCsharp's chromecast sample ( https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/Chromecast/Chromecast )
My code is in a windows form (stream on chromecast when I click on the "Button_DIFFUSER" button)
The error is https://imgur.com/mVb6wtN but the dll files are here...
Code: Select all
public partial class Form_MAIN : Form {
readonly HashSet<RendererItem> _rendererItems = new HashSet<RendererItem>();
LibVLC _libVLC;
MediaPlayer _mediaPlayer;
RendererDiscoverer _rendererDiscoverer;
private async void Button_DIFFUSER_ClickAsync(object sender, EventArgs e) {
try {
DiscoverChromecasts();
await Task.Delay(2000);
StartCasting();
}
catch(Exception err) {
MessageBox.Show("erreur : "+err);
}
}
private void StartCasting() {
if(!_rendererItems.Any()) {
MessageBox.Show("No renderer items found. Abort casting...");
return;
}
var media = new Media(_libVLC, "axrtsp://192.168.1.221/axis-media/media.amp", FromType.FromLocation);
_mediaPlayer = new MediaPlayer(_libVLC);
_mediaPlayer.SetRenderer(_rendererItems.First());
_mediaPlayer.Play(media);
}
bool DiscoverChromecasts() {
Core.Initialize();
_libVLC = new LibVLC();
RendererDescription renderer;
renderer = _libVLC.RendererList.FirstOrDefault(r => r.Name.Equals("microdns_renderer"));
_rendererDiscoverer = new RendererDiscoverer(_libVLC, renderer.Name);
_rendererDiscoverer.ItemAdded += RendererDiscoverer_ItemAdded;
return _rendererDiscoverer.Start();
}
void RendererDiscoverer_ItemAdded(object sender, RendererDiscovererItemAddedEventArgs e) {
MessageBox.Show($"New item discovered: {e.RendererItem.Name} of type {e.RendererItem.Type}");
if(e.RendererItem.CanRenderVideo) MessageBox.Show("Can render video");
if(e.RendererItem.CanRenderAudio) MessageBox.Show("Can render audio");
_rendererItems.Add(e.RendererItem);
}
}
Re: [C#] Chromecast stream from local IP camera
Posted: 12 Dec 2019 04:27
by mfkl
Share your full code in a git repository
Re: [C#] Chromecast stream from local IP camera
Posted: 12 Dec 2019 09:45
by Bakineo
Hi,
Here the Form_REPLAY.cs file : https://gitlab.com/Obvie/vlc-chromecast/blob/master/Form_REPLAY.cs
I don't think I can share the full code because it's for work
Thank you !
Re: [C#] Chromecast stream from local IP camera
Posted: 16 Dec 2019 04:08
by mfkl
Can you stream it with the official VLC apps?
Can you share some logs?