public override void LoadView()
        {
            base.LoadView();

            View.BackgroundColor = UIColor.White;

            _downloadProgressLabel = new UILabel()
            {
                Text          = "Download state",
                TextColor     = UIColor.Magenta,
                TextAlignment = UITextAlignment.Center,
            };
            View.AddSubview(_downloadProgressLabel);

            _startButton = new UIButton(UIButtonType.System);
            _startButton.SetTitle("Click me", UIControlState.Normal);
            View.AddSubview(_startButton);

            castManager = OOCastManager.CastManagerWithAppID("4172C76F", "urn:x-cast:ooyala");
            castManager.WeakDelegate = this;

            var options = new OOAssetDownloadOptions();

            options.Pcode     = "c0cTkxOqALQviQIGAHWY5hP0q9gU";
            options.EmbedCode = _embedCode;
            options.Domain    = new OOPlayerDomain("http://www.ooyala.com");
            _videoAsset       = new OODtoAsset(options, "Clear HLS Video");
            _videoAsset.DownloadWithProgressClosure(HandleProgressParameter);
            _videoAsset.FinishWithRelativePath(HandleFinishParameter);
            _videoAsset.OnErrorWithErrorClosure(HandleErrorParameter);
            _downloadProgressLabel.Text = _videoAsset.StateText;
            var castPlayer = new OOOoyalaPlayer(
                pcode: "c0cTkxOqALQviQIGAHWY5hP0q9gU",
                domain: new OOPlayerDomain("http://www.ooyala.com"));

            castPlayer.InitCastManager(castManager);

            var rightButton = new UIBarButtonItem(castManager.CastButton);

            NavigationItem.RightBarButtonItem = rightButton;

            _castVC = new OOOoyalaPlayerViewController(player: castPlayer);
        }
        public CastMiniControllerView(
            CGRect frame,
            OOCastManager castManager,
            NSObject del)
            : base(frame, castManager, del)
        {
            _castManager = castManager;
            _delegate    = del;

            var castPlayer = (OOCastPlayer)_castManager.CastPlayer;

            this.Cell = new UITableViewCell(UITableViewCellStyle.Default, "cell");
            this.Cell.BackgroundColor = UIColor.FromRGB(255, 255, 255);
            this.Cell.TextLabel.Text  = castPlayer?.CastItemTitle;
            this.Cell.SelectionStyle  = UITableViewCellSelectionStyle.None;

            // Accessory is the play/pause button.
            _pauseImage = UIImage.FromBundle("pause.png");
            _playImage  = UIImage.FromBundle("play.png");

            _button = new UIButton();
            _button.TouchUpInside += Button_TouchUpInside;

            var playing = (castPlayer?.State == OOOoyalaPlayerState.Playing ||
                           castPlayer?.State == OOOoyalaPlayerState.Loading);
            var buttonImage = (true ? _pauseImage : _playImage);

            _button.SetBackgroundImage(buttonImage, forState: UIControlState.Normal);

            this.Cell.AccessoryView = _button;

            this.Cell.ImageView.Image = UIImage.FromBundle("ooyala_logo.png");

            Cell.SetNeedsLayout();
            AddSubview(this.Cell);
        }
Esempio n. 3
0
        public override void LoadView()
        {
            base.LoadView();

            View.BackgroundColor = UIColor.White;

            _startButton = new UIButton(UIButtonType.System);
            _startButton.SetTitle("Click me", UIControlState.Normal);
            View.AddSubview(_startButton);

            castManager = OOCastManager.CastManagerWithAppID("4172C76F", "urn:x-cast:ooyala");
            castManager.WeakDelegate = this;

            var options = new OOAssetDownloadOptions();

            options.Pcode     = "c0cTkxOqALQviQIGAHWY5hP0q9gU";
            options.EmbedCode = _embedCode;
            options.Domain    = new OOPlayerDomain("http://www.ooyala.com");
            //options.EmbedTokenGenerator = new TokenGenerator();
            var manager = new OOAssetDownloadManager(options);

            manager.WeakDelegate = this;
            manager.StartDownload();

            var castPlayer = new OOOoyalaPlayer(
                pcode: "c0cTkxOqALQviQIGAHWY5hP0q9gU",
                domain: new OOPlayerDomain("http://www.ooyala.com"));

            castPlayer.InitCastManager(castManager);

            var rightButton = new UIBarButtonItem(castManager.CastButton);

            NavigationItem.RightBarButtonItem = rightButton;

            _castVC = new OOOoyalaPlayerViewController(player: castPlayer);
        }