From 3e1ad373bc4c4905467362d0c831449fb3afecf0 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Fri, 19 Apr 2019 15:18:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0DEMO=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0libvlc=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Demo/Demo.Android/Demo.Android.csproj | 5 +- .../Resources/Resource.designer.cs | 3 + projects/Demo/Demo.iOS/Demo.iOS.csproj | 5 +- projects/Demo/Demo/Demo.csproj | 11 +- projects/Demo/Demo/MainPage.xaml.cs | 5 + projects/Demo/Demo/OnvifPage.xaml | 13 + projects/Demo/Demo/OnvifPage.xaml.cs | 45 ++ projects/Demo/Demo/wwwroot/index.html | 398 ++++++++---------- projects/Demo/Demo/wwwroot/js/app.js | Bin 28580 -> 30080 bytes 9 files changed, 255 insertions(+), 230 deletions(-) create mode 100644 projects/Demo/Demo/OnvifPage.xaml create mode 100644 projects/Demo/Demo/OnvifPage.xaml.cs diff --git a/projects/Demo/Demo.Android/Demo.Android.csproj b/projects/Demo/Demo.Android/Demo.Android.csproj index 53c35b06..71425534 100644 --- a/projects/Demo/Demo.Android/Demo.Android.csproj +++ b/projects/Demo/Demo.Android/Demo.Android.csproj @@ -49,7 +49,10 @@ - + + 3.1.2 + + diff --git a/projects/Demo/Demo.Android/Resources/Resource.designer.cs b/projects/Demo/Demo.Android/Resources/Resource.designer.cs index 7768330c..ad8ed41c 100644 --- a/projects/Demo/Demo.Android/Resources/Resource.designer.cs +++ b/projects/Demo/Demo.Android/Resources/Resource.designer.cs @@ -6125,6 +6125,9 @@ namespace Demo.Droid // aapt resource value: 0x7f080026 public const int abc_toolbar_collapse_description = 2131230758; + // aapt resource value: 0x7f08003d + public const int app_name = 2131230781; + // aapt resource value: 0x7f080034 public const int appbar_scrolling_view_behavior = 2131230772; diff --git a/projects/Demo/Demo.iOS/Demo.iOS.csproj b/projects/Demo/Demo.iOS/Demo.iOS.csproj index 1bd4a7bb..af05a6bd 100644 --- a/projects/Demo/Demo.iOS/Demo.iOS.csproj +++ b/projects/Demo/Demo.iOS/Demo.iOS.csproj @@ -166,7 +166,10 @@ - + + 3.1.5-alpha + + diff --git a/projects/Demo/Demo/Demo.csproj b/projects/Demo/Demo/Demo.csproj index 8c310f2c..9e133a41 100644 --- a/projects/Demo/Demo/Demo.csproj +++ b/projects/Demo/Demo/Demo.csproj @@ -10,9 +10,10 @@ - + + - + @@ -24,5 +25,9 @@ - + + + MSBuild:UpdateDesignTimeXaml + + \ No newline at end of file diff --git a/projects/Demo/Demo/MainPage.xaml.cs b/projects/Demo/Demo/MainPage.xaml.cs index f38673d9..877b3917 100644 --- a/projects/Demo/Demo/MainPage.xaml.cs +++ b/projects/Demo/Demo/MainPage.xaml.cs @@ -29,6 +29,11 @@ namespace Demo e.Cancel = true; CrossLocalNotifications.Current.Show("title", e.Url); } + else if (e.Url.Contains("rtmp://")) + { + e.Cancel = true; + this.Navigation.PushAsync(new OnvifPage(e.Url)); + } } private void WebView_Navigated(object sender, WebNavigatedEventArgs e) diff --git a/projects/Demo/Demo/OnvifPage.xaml b/projects/Demo/Demo/OnvifPage.xaml new file mode 100644 index 00000000..29395744 --- /dev/null +++ b/projects/Demo/Demo/OnvifPage.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/projects/Demo/Demo/OnvifPage.xaml.cs b/projects/Demo/Demo/OnvifPage.xaml.cs new file mode 100644 index 00000000..3c1fa508 --- /dev/null +++ b/projects/Demo/Demo/OnvifPage.xaml.cs @@ -0,0 +1,45 @@ +using LibVLCSharp.Shared; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace Demo +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class OnvifPage : ContentPage + { + private readonly string _url; + private readonly LibVLC _libvlc; + + public OnvifPage(string url) + { + this._url = url; + InitializeComponent(); + Core.Initialize(); + this._libvlc = new LibVLC(); + } + + protected override void OnAppearing() + { + var media = new Media(_libvlc, this._url, FromType.FromLocation); + media.AddOption(new MediaConfiguration().EnableHardwareDecoding()); + media.AddOption(":network-caching=0"); + media.AddOption(":clock-jitter=0"); + media.AddOption(":clock-synchro=0"); + var player = new MediaPlayer(_libvlc); + videoView.MediaPlayer = player; + player.Play(media); + } + + protected override void OnDisappearing() + { + this.videoView.MediaPlayer.Stop(); + } + + protected override bool OnBackButtonPressed() + { + this.videoView.MediaPlayer.Stop(); + return base.OnBackButtonPressed(); + } + } +} \ No newline at end of file diff --git a/projects/Demo/Demo/wwwroot/index.html b/projects/Demo/Demo/wwwroot/index.html index c58fa9ee..876444a2 100644 --- a/projects/Demo/Demo/wwwroot/index.html +++ b/projects/Demo/Demo/wwwroot/index.html @@ -75,7 +75,7 @@
  • - +
  • @@ -155,8 +155,8 @@
    场景
    @@ -165,26 +165,27 @@
    监测
    -
    - -
    -
    {{getData(device,"温度")}}
    -
    {{getData(device,"湿度")}}
    -
    -
    -
    {{getData(device,"二氧化碳")}}
    -
    -
    -
    {{getData(device,"光照强度")}}
    -
    -
    -
    {{getData(device,"粉尘")}}
    -
    -
    -
    未定义
    -
    +
    @@ -193,13 +194,12 @@
    警报
    @@ -208,17 +208,21 @@
    主机
    - +
    +
    +
    @@ -228,17 +232,9 @@
    无线AP
    -
    - -
    -
    IP {{getData(device,"IP")}}
    -
    连接数:{{getData(device,"连接数")}}
    -
    -
    - 设备 -
    +
    @@ -247,27 +243,20 @@
    一路可调窗帘
    -
    -
    - @@ -277,24 +266,20 @@
    计量开关
    -
    -
    - @@ -304,24 +289,20 @@
    一路开关
    -
    -
    - @@ -331,32 +312,24 @@
    二路灯开关
    -
    -
    - @@ -366,32 +339,26 @@
    三路照明开关
    -
    -
    - @@ -401,24 +368,20 @@
    墙面插座
    -
    -
    - @@ -428,24 +391,20 @@
    一路插座
    -
    -
    - @@ -455,24 +414,20 @@
    二路插座
    -
    -
    - @@ -482,22 +437,18 @@
    密码门锁
    -
    -
    -
    +
    +
    @@ -507,17 +458,13 @@
    红外转发器