Code Monkey home page Code Monkey logo

youtubeplayer-in-wkwebview's Introduction

YoutubePlayer-in-WKWebView

YoutubePlayer-in-WKWebView version YoutubePlayer-in-WKWebView platform ios 8.0

YoutubePlayer-in-WKWebView is forked from youtube-ios-player-helper For using WKWebView.

  • class prefix changed to WKYT from YT. YTPlayerView -> WKYTPlayerView
  • using WKWebView instead of UIWebView.
  • getting properties asynchronously.
	// YTPlayerView
	NSTimeInterval duration = self.playerView.duration;

	// WKYTPlayerView
    [self.playerView getDuration:^(NSTimeInterval duration, NSError * _Nullable error) {
        if (!error) {
            float seekToTime = duration * self.slider.value;
        }
    }];

Usage

To run the example project; clone the repo, and run pod install from the Project directory first. For a simple tutorial see this Google Developers article - Using the YouTube Helper Library to embed YouTube videos in your iOS application.

Requirements

Installation

YouTube-Player-iOS-Helper is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "YoutubePlayer-in-WKWebView", "~> 0.3.0"

After installing in your project and opening the workspace, to use the library:

  1. Drag a UIView the desired size of your player onto your Storyboard.
  2. Change the UIView's class in the Identity Inspector tab to WKYTPlayerView
  3. Import "WKYTPlayerView.h" in your ViewController.
  4. Add the following property to your ViewController's header file:
    @property(nonatomic, strong) IBOutlet WKYTPlayerView *playerView;
  1. Load the video into the player in your controller's code with the following code:
    [self.playerView loadWithVideoId:@"M7lc1UVf-VE"];
  1. Run your code!

See the sample project for more advanced uses, including passing additional player parameters, custom html and working with callbacks via WKYTPlayerViewDelegate.

License

YoutubePlayer-in-WKWebView is available under the Apache 2.0 license. See the LICENSE file for more info.

youtubeplayer-in-wkwebview's People

Contributors

anislav avatar baza207 avatar benjaminjackson avatar chanonly123 avatar choli avatar crtgregoric avatar desislava-staykova avatar dictav avatar felipecarreramo avatar hmhv avatar hongmhoon avatar ikai avatar jackyoustra avatar jacobmao avatar jalsnipe avatar jlampa avatar jminutaglio avatar krider2010 avatar m-keil avatar martin-marinov avatar mattdavidcool avatar nvh avatar olala7846 avatar powerje avatar r-magz avatar raman148 avatar samiq avatar sidferreira avatar ulukaya avatar yukitoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtubeplayer-in-wkwebview's Issues

Video not playing properly

When I start playing the video, it is not showing properly. It takes time to load and the screen misbehaves for a while and then it start playing properly.
What can be done?

ITMS-90338: Non-public API usage

Halo, I got this issue while uploading my apps to testflight. This issue message is ITMS-90338: Non-public API usage The app references non-public selectors in Frameworks/YoutubePlayer_in_WKWebView.framework/YoutubePlayer_in_WKWebView: initWithFrame:configuration:, isMainFrame, setNavigationDelegate:, targetFrame. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. Is there any suggestion about this issue? Thank you

Get Options Delegate method

I need to change the default value of the size of the captions. From what I can tell that is done via onApiChange callback that doesn't appear to be exposed via the delegate. It would be nice to have that ability.

Inconsistent player controls

Hi,

I am using the following params to load the youtube video
let playerVars:[String: Any] = [ "autoplay": "0","cc_load_policy":"0", "rel": "0", "playsinline" : "0", "showinfo":"1", "controls":"1", "modestbranding" : "1","iv_load_policy":"3","fs":1 ]

mediaplayer?.load(withVideoId: videoID, playerVars: playerVars)

how ever the controls are shown inconsistently. Please refer to the attached screenshots, the first image is the required and the second is the error controls obtained. Controls are working fine in emulator , but goes inconsistent in real device.

Expected

Error

App Store Connect Operation Error

I'm getting this error when trying to upload to the app store, yesterday everything was fine, and today I got this message:

App Store Connect Operation Error

The app references non-public selectors in Payload/MyApp.app/Frameworks/YoutubePlayer_in_WKWebView.framework/YoutubePlayer_in_WKWebView: initWithFrame:configuration:, isMainFrame, setNavigationDelegate: With error code STATE_ERROR.VALIDATION_ERROR.50 for id 183c8e2d-b71c-44e8-b66a-8dac1571cc94

Change WKYTPlayerView output to speaker in Swift?

I am currently facing some issues with my application, I am trying to stream youtube videos in iOS 16.1 using WKYTPlayerView.
here the player audio is not output to the speaker in Swift.

but previously it was working well.

I have tried the below code but it's not working

let audioSession = AVAudioSession.sharedInstance()

    do {
        try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.voiceChat, options: AVAudioSession.CategoryOptions.mixWithOthers)
        try audioSession.overrideOutputAudioPort(.none)
        try audioSession.setActive(true)
    } catch {
        debugPrint(error.localizedDescription)
    }

can anyone please suggest something?

Multiple commands produce PrivacyInfo.xcprivacy

I am currently working on a project and have encountered an issue
when trying to build with PrivacyInfo.xcprivacy added.

The error message I am receiving is as follows:

Multiple commands produce '/Users/tomoyo.makino/Library/Developer/Xcode/DerivedData/MyProject-xxx/ArchiveIntermediates/MyProject(Production)/InstallationBuildProductsLocation/Applications/MyProject.app/MyProject'

While I haven't been able to definitively identify the cause,
I believe it may be related to a similar issue reported here:

Error: ’Multiple commands produce PrivacyInfo.xcprivacy’ (when using a third party library via cocoapods)

Solution: The problem seems to appear when using 3rd party cocoapods which include a PrivacyInfo.xcprivacy file.

The problem must be solved by the developer of the 3rd party lib by changing the podspec:
Change:

sp.resource = “Sources/Resources/PrivacyInfo.xcprivacy”

to

sp.resource_bundles = { “Podname” => “Sources/Resources/PrivacyInfo.xcprivacy” }

I would greatly appreciate it if you could consider making changes to the podspec.

Other references

CocoaPods/CocoaPods#10325 (comment)

https://developer.apple.com/forums/thread/733537

version

0.3.9

System Information

System:
  macOS 14.4.1 / Apple M1

Managers:
  CocoaPods:
    version: 1.15.2

IDEs:
  Xcode:
    version: 15.2

Steps to Reproduce

trying to build with XCode:
Product > Archive

Privacy Manifest

From Apple docs:

Starting in spring 2024, you must include the privacy manifest for any SDK listed below when you submit new apps in App Store Connect that include those SDKs, or when you submit an app update that adds one of the listed SDKs as part of the update. Signatures are also required in these cases where the listed SDKs are used as binary dependencies.

Could you please add a privacy manifest for this library?

Set up the volume of the player

Hi everyone,

I have a problem with setting up the volume of the player. I am using this. But it isn't working.
videoView.webView?.evaluateJavaScript("player.setVolume(\(volume));"
Is there anyway to set up the volume?

Thanks!

Video automatically paused while changing the mode from full screen to normal

Hello Team,

I am facing one issue.

When I am changing the mode to full screen, it is working fine. If video is in playing state, then state will be same in full screen too.

But when I am returning back from full screen to normal, and video is playing, then automatically it is stopped after changing the mode to normal.

Please let us know how can we solved? I checked all the properties, but not able to get succeed yet.

Thanks,

Cannot get time play on videos

We have this error
Screen Shot 2022-03-29 at 15 31 20

Step to reproduce this issue:
1 - Play a youtube video using this framework
2 - debug and get value of getCurrentTime. It will appear 0
3 - Change mode in Portrait or Landscape mode.
4 - Repeat step 2

If we debugging on this code to get the time of the video, we always get 0
Screen Shot 2022-03-29 at 15 51 32
getCurrentTime is from YoutubePlayer-in-WKWebView

Framework YoutubePlayer-in-WKWebView

Add Privacy Manifest

From Apple docs:

Starting in spring 2024, you must include the privacy manifest for any SDK listed below when you submit new apps in App Store Connect that include those SDKs, or when you submit an app update that adds one of the listed SDKs as part of the update. Signatures are also required in these cases where the listed SDKs are used as binary dependencies.

Add a privacy manifest for this library? See the following URLs for additional information:

https://developer.apple.com/news/?id=r1henawx
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files

target 14.2

Pods/YoutubePlayer-in-WKWebView/WKYTPlayerView/WKYTPlayerView.m:850:44: 'openURL:options:completionHandler:' is unavailable: not available on iOS (App Extension)
Screenshot 2021-11-18 at 3 46 19 PM

autoplay / playinline are not working

Hey, @hmhv for React Native the autoplay and playsinline options aren't working.
I tried to run in a sandbox and seems to not work as well.

Any guess on what may be the problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.