Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mPlayerView = FindViewById <JWPlayerView>(Resource.Id.jwplayer);
            TextView outputTextView = FindViewById <TextView>(Resource.Id.output);

            toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            // Handle hiding/showing of ActionBar
            SetSupportActionBar(toolbar);
            mPlayerView.AddOnFullscreenListener(this);

            // Instantiate the JW Player event handler class
            mEventHandler = new JWEventHandler(mPlayerView, outputTextView);

            // Load a media source
            PlaylistItem pi = new PlaylistItem("http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8");

            mPlayerView.Load(pi);
            mCastManager = CastManager.Instance;
            mCastManager.AddDeviceListener(new DeviceListener());
            mCastManager.AddPlayerListener(new PlayerListener());
            mCastManager.AddApplicationListener(new ApplicationListener());
            mCastManager.AddConnectionListener(new ConnectionListener());
            mCastManager.AddErrorListener(new ErrorListener());
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_fragment);

            TextView outputTextView = FindViewById <TextView>(Resource.Id.output);

            mPlayerFragment = JWPlayerSupportFragment.NewInstance(new PlayerConfig.Builder()
                                                                  .File("http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8")
                                                                  .Build());

            Android.Support.V4.App.FragmentManager     fm = this.SupportFragmentManager;
            Android.Support.V4.App.FragmentTransaction ft = fm.BeginTransaction();
            ft.Add(Resource.Id.fragment_container, mPlayerFragment);
            ft.Commit();
            fm.ExecutePendingTransactions();

            mPlayerView = mPlayerFragment.Player;

            new KeepScreenOnHandler(mPlayerView, Window);

            mEventHandler = new JWEventHandler(mPlayerView, outputTextView);
        }