// Activity lifecycle

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            shouldAutoPlay = true;
            ClearResumePosition();
            mediaDataSourceFactory = BuildDataSourceFactory(true);
            mainHandler            = new Handler();
            if (CookieHandler.Default != DEFAULT_COOKIE_MANAGER)
            {
                CookieHandler.Default = DEFAULT_COOKIE_MANAGER;
            }

            SetContentView(Resource.Layout.player_activity);
            var rootView = FindViewById(Resource.Id.root);

            rootView.SetOnClickListener(this);
            debugRootView = FindViewById <LinearLayout>(Resource.Id.controls_root);
            debugTextView = FindViewById <TextView>(Resource.Id.debug_text_view);
            retryButton   = FindViewById <Button>(Resource.Id.retry_button);
            retryButton.SetOnClickListener(this);

            simpleExoPlayerView = FindViewById <SimpleExoPlayerView>(Resource.Id.player_view);
            simpleExoPlayerView.SetControllerVisibilityListener(this);
            simpleExoPlayerView.RequestFocus();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AdaptiveStreaming.Droid.Exo.AdaptivePlayer"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        public AdaptivePlayer(Context context) : base(context)
        {
            _context = context;

            //_log = IoC.Resolve<ILogger>();
            //_tag = $"{GetType()} ";

            UserAgent = Util.GetUserAgent(_context, "AdaptiveStreaming.Droid");

            _shouldAutoPlay         = true;
            _mediaDataSourceFactory = BuildDataSourceFactory(true);
            _mainHandler            = new Handler();

            if (CookieHandler.Default != _defaultCookieManager)
            {
                CookieHandler.Default = _defaultCookieManager;
            }

            var inflater = LayoutInflater.FromContext(context);

            if (inflater != null)
            {
                var view = inflater.Inflate(Resource.Layout.player_activity, this);
            }

            View rootView = FindViewById(Resource.Id.root);

            rootView.SetOnClickListener(this);
            _debugRootView = (LinearLayout)FindViewById(Resource.Id.controls_root);
            _debugTextView = (TextView)FindViewById(Resource.Id.debug_text_view);
            _retryButton   = (Button)FindViewById(Resource.Id.retry_button);
            _retryButton.SetOnClickListener(this);

            _simpleExoPlayerView = (SimpleExoPlayerView)FindViewById(Resource.Id.player_view);
            _simpleExoPlayerView.SetControllerVisibilityListener(this);
            _simpleExoPlayerView.RequestFocus();
        }
Beispiel #3
0
 private void Init(Context context)
 {
     PlayerView = new SimpleExoPlayerView(context);
     this.AddView(PlayerView);
 }