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

feat(ios): Add optional delegate to retrieve player in native side #2533

Closed

Conversation

Minishlink
Copy link

@Minishlink Minishlink commented Nov 10, 2021

Useful when you want to access the player in native side (eg. for SharePlay/GroupActivities)

Related issue #2444

In AppDelegate.m:

#import "RCTVideoPlayerViewController.h"

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    MyVideoPlayerDelegate *myVideoPlayerDelegate = [[MyVideoPlayerDelegate alloc] init];
    RCTVideoPlayerViewController.videoPlayerDelegate = myVideoPlayerDelegate;

In MyVideoPlayerDelegate.swift (works also in equivalent objective-c...)

import AVFoundation

@objc(MyVideoPlayerDelegate)
class MyVideoPlayerDelegate : NSObject, RCTVideoPlayerDelegate {
  func playerDidAppear(_ player: AVPlayer!) {
    // do something when player is mounted
  }

  func playerDidDisappear() {
    // do something when player is unmounted
  }
}

@stale
Copy link

stale bot commented Apr 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you are having a similar problem, please open a new issue and reference this one instead of commenting on a stale or closed issue.

@stale stale bot added the stale Closed due to inactivity or lack or resources label Apr 19, 2022
@hueniverse hueniverse removed the stale Closed due to inactivity or lack or resources label Apr 20, 2022
@TheWidlarzGroup TheWidlarzGroup deleted a comment from nickfujita Jun 23, 2022
@hueniverse
Copy link
Contributor

Closing due to lack of response (from the original submitted or anyone else to review and rebase). If someone wants to pick this up please open a new PR that ports this code into the current master. We are doing our best to start clean with v6 which requires being a bit aggressive in closing stale PRs that are over a year old. Please don't consider this dismissing of your work and contribution - it's greatly appreciated.

@hueniverse hueniverse closed this Jun 23, 2022
@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label Jun 23, 2022
@Minishlink
Copy link
Author

@hueniverse Is there something missing in this PR? Is v6 completely in Swift now?

@hueniverse
Copy link
Contributor

Yes, we switched to Swift. It was closed because there has been no activity on it after the stale bot warning 2 months ago. I don't know if there is anything wrong with the PR other than no one else showed interest in the feature or reviewing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS stale Closed due to inactivity or lack or resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants