Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast Mini Controller #8

Open
lochstar opened this issue May 28, 2019 · 4 comments
Open

Cast Mini Controller #8

lochstar opened this issue May 28, 2019 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lochstar
Copy link
Owner

lochstar commented May 28, 2019

The current iOS work in progress. Visibilty of the Controller needs to be handled. Doesn't work unless added to a layout, which is why I've created a new StackLayout in createNativeView().

export class CastMiniController extends CastMiniControllerBase {
  nativeView: any;

  constructor() {
    super();
  }

  public createNativeView(): Object {
    const stackLayout = new StackLayout();
    return stackLayout.ios;
  }

  /**
   * Initializes properties/listeners of the native view.
   */
  initNativeView(): void {
    // Attach the owner to nativeView.
    // When nativeView is tapped we get the owning JS object through this field.
    (<any>this.nativeView).owner = this;

    super.initNativeView();
  }

  /**
   * Clean up references to the native view and resets nativeView to its original state.
   * If you have changed nativeView in some other way except through setNative callbacks
   * you have a chance here to revert it back to its original state
   * so that it could be reused later.
   */
  disposeNativeView(): void {
    // Remove reference from native listener to this instance.
    (<any>this.nativeView).owner = null;

    // If you want to recycle nativeView and have modified the nativeView
    // without using Property or CssProperty (e.g. outside our property system - 'setNative' callbacks)
    // you have to reset it to its initial state here.
    super.disposeNativeView();
  }

  onLoaded(): void {
    const mCastContext = GCKCastContext.sharedInstance();
    const miniController = mCastContext.createMiniMediaControlsViewController();
    this.nativeView.addSubview(miniController.view);
    super.onLoaded();
  }
}
@lochstar lochstar added the enhancement New feature or request label May 28, 2019
@lochstar lochstar added the help wanted Extra attention is needed label Oct 28, 2019
@promptdigital
Copy link

@lochstar did you manage to make the mini controller work? I am using this plugin and hoping to add the mini controller in my app.

@lochstar
Copy link
Owner Author

@promptdigital IIRC I never could get this to work on Android. Spent ages trying.

@promptdigital
Copy link

I have someone help me get it working on Android now. Do you have iOS version working by any chance?

@lochstar
Copy link
Owner Author

Just the code I pasted above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants