public MediaView(Context context) : base(context) { _context = context; _eglBaseContext = AndroidSupport.GetNativeEglBase().EglBaseContext; _rendererView = new Webrtc.SurfaceViewRenderer(context); _rendererView.SetMirror(false); _rendererView.SetEnableHardwareScaler(true); _rendererView.Init(_eglBaseContext, null); AddView(_rendererView); }
public void SetTrack(IMediaStreamTrack videoTrack) { var nativeVideoTrack = videoTrack.NativeObject as Webrtc.VideoTrack; var cameraEnum = new Webrtc.Camera2Enumerator(_context); var cameraDevices = cameraEnum.GetDeviceNames(); _isCamera = cameraDevices.Any(device => device == videoTrack.Id); if (_isCamera) { var nativeVideoSource = AndroidSupport.GetNativeVideoSource(videoTrack); var videoCapturer = cameraEnum.CreateCapturer(videoTrack.Id, null); videoCapturer.Initialize( Webrtc.SurfaceTextureHelper.Create( "CameraVideoCapturerThread", _eglBaseContext), _context, nativeVideoSource.CapturerObserver); videoCapturer.StartCapture(480, 640, 30); } nativeVideoTrack.AddSink(_rendererView); }
/// <summary> /// Конструктор. Точка входа приложения /// </summary> public App() { // Инициализация InitializeComponent(); // Общая конструкция страниц приложения MainPage = new MasterPage(); solutionPage = AndroidSupport.ApplyPageSettings(MainPage, "SolutionPage", Localization.GetText("SolutionPage", al), solutionMasterBackColor); aboutPage = AndroidSupport.ApplyPageSettings(MainPage, "AboutPage", Localization.GetText("AboutPage", al), aboutMasterBackColor); #region Основная страница AndroidSupport.ApplyButtonSettings(solutionPage, "ResetButton", Localization.GetText("ResetButton", al), solutionFieldBackColor, ResetButton_Clicked); AndroidSupport.ApplyButtonSettings(solutionPage, "RestartButton", Localization.GetText("RestartButton", al), solutionFieldBackColor, RestartButton_Clicked); AndroidSupport.ApplyButtonSettings(solutionPage, "NextButton", Localization.GetText("NextButton", al), solutionFieldBackColor, NextButton_Clicked); activityLabel = AndroidSupport.ApplyLabelSettings(solutionPage, "ActivityLabel"); for (int i = 0; i < masterLinesCount; i++) { objectsFields[i] = AndroidSupport.ApplyEditorSettings(solutionPage, "ObjectField" + i.ToString("D02"), solutionFieldBackColor, Keyboard.Default, 50, "", ObjectName_TextChanged); textFields[i] = AndroidSupport.ApplyEditorSettings(solutionPage, "TextField" + i.ToString("D02"), solutionFieldBackColor, Keyboard.Default, 50, "", CriteriaName_TextChanged); valueFields[i] = AndroidSupport.ApplySliderSettings(solutionPage, "ValueField" + i.ToString("D02")); } // Получение настроек перед инициализацией try { for (int i = 0; i < masterLinesCount; i++) { objects.Add(Preferences.Get(objectsRegKey + i.ToString("D2"), "")); criteria.Add(Preferences.Get(criteriaRegKey + i.ToString("D2"), "")); values.Add(int.Parse(Preferences.Get(valuesRegKey + i.ToString("D2"), "1"))); } firstStart = Preferences.Get(firstStartRegKey, "") == ""; } catch { } // Инициализация зависимых полей ResetApp(false); #endregion #region Страница "О программе" aboutLabel = AndroidSupport.ApplyLabelSettings(aboutPage, "AboutLabel", ProgramDescription.AssemblyTitle + "\n" + ProgramDescription.AssemblyDescription + "\n\n" + ProgramDescription.AssemblyCopyright + "\nv " + ProgramDescription.AssemblyVersion + "; " + ProgramDescription.AssemblyLastUpdate, Color.FromHex("#000080")); aboutLabel.FontAttributes = FontAttributes.Bold; aboutLabel.HorizontalTextAlignment = TextAlignment.Center; AndroidSupport.ApplyButtonSettings(aboutPage, "AppPage", Localization.GetText("AppPage", al), aboutFieldBackColor, AppButton_Clicked); AndroidSupport.ApplyButtonSettings(aboutPage, "ADPPage", Localization.GetText("ADPPage", al), aboutFieldBackColor, ADPButton_Clicked); AndroidSupport.ApplyButtonSettings(aboutPage, "CommunityPage", AndroidSupport.MasterLabName, aboutFieldBackColor, CommunityButton_Clicked); AndroidSupport.ApplyButtonSettings(aboutPage, "DevPage", Localization.GetText("DevPage", al), aboutFieldBackColor, DevButton_Clicked); AndroidSupport.ApplyButtonSettings(aboutPage, "SolutionAboutPage", Localization.GetText("SolutionAboutPage", al), aboutFieldBackColor, SolutionAboutButton_Clicked); AndroidSupport.ApplyButtonSettings(aboutPage, "LanguageSelector", Localization.LanguagesNames[(int)al], aboutFieldBackColor, SelectLanguage_Clicked); AndroidSupport.ApplyLabelSettings(aboutPage, "LanguageLabel", Localization.GetText("LanguageLabel", al)); #endregion // Отображение подсказок первого старта ShowTips(1); }