This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override Task LoadAsync() | |
{ | |
_playbackService.Init(); | |
MessagingCenter.Subscribe<string, float>(MessengerKeys.App, | |
MessengerKeys.Position, (app, position) => Progress = position); | |
MessagingCenter.Subscribe<string, long>(MessengerKeys.App, | |
MessengerKeys.Time, (app, time) => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const long OFFSET = 5000; | |
// subscribe to UI app events for seeking. | |
MessagingCenter.Subscribe<string>(MessengerKeys.App, | |
MessengerKeys.Rewind, vm => _mp.Time -= OFFSET); | |
MessagingCenter.Subscribe<string>(MessengerKeys.App, | |
MessengerKeys.Forward, vm => _mp.Time += OFFSET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
readonly MediaPlayer _mp; | |
const string URL = "https://archive.org/download/ImagineDragons_201410/imagine%20dragons.mp4"; | |
public void Init() | |
{ | |
// create a libvlc media | |
_mp.Media = new Media(_libVLC, URL, Media.FromType.FromLocation); | |
// disable video output, we only need audio | |
_mp.Media.AddOption(":no-video"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<controls:CircleProgress | |
Grid.Row="0" | |
VerticalOptions="FillAndExpand" | |
HorizontalOptions="FillAndExpand" | |
Progress="{Binding Progress}" | |
LineBackgroundColor ="{StaticResource BlackColor}" | |
ProgressColor="{StaticResource PlayerRedColor}" | |
StrokeWidth="12" | |
Margin="12"/> | |
<buttonCircle:CircleButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void StartCasting() | |
{ | |
// create a media | |
var media = new Media(_libVLC, | |
"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", | |
Media.FromType.FromLocation); | |
// create the mediaplayer | |
_mediaPlayer = new MediaPlayer(_libVLC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void RendererDiscoverer_ItemAdded(object sender, RendererDiscovererItemAddedEventArgs e) | |
{ | |
WriteLine($"New item discovered: {e.RendererItem.Name} of type {e.RendererItem.Type}"); | |
if (e.RendererItem.CanRenderVideo) | |
WriteLine("Can render video"); | |
if (e.RendererItem.CanRenderAudio) | |
WriteLine("Can render audio"); | |
// add newly found renderer item to local collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MainPage : ContentPage | |
{ | |
const string VIDEO_URL = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov"; | |
readonly LibVLC _libvlc; | |
public MainPage() | |
{ | |
InitializeComponent(); | |
// this will load the native libvlc library (if needed, depending on the platform). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:local="clr-namespace:VideoMosaic" | |
xmlns:shared="clr-namespace:LibVLCSharp.Forms.Shared;assembly=LibVLCSharp.Forms" | |
x:Class="VideoMosaic.MainPage"> | |
<Grid x:Name="MainGrid"> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="*"/> | |
<RowDefinition Height="*"/> | |
</Grid.RowDefinitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void DiscoverChromecasts() | |
{ | |
// load native libvlc libraries | |
Core.Initialize(); | |
// create core libvlc object | |
_libVLC = new LibVLC(); | |
// create a renderer discoverer | |
_rendererDiscoverer = new RendererDiscoverer(_libVLC); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace CustomResponseNetCore | |
{ | |
public class Startup | |
{ |