Integration of youtube in my iOS app

旧巷老猫 提交于 2019-12-11 02:40:01

问题


I have been searching something useful so that I can play the youtube in my iOS app, just like the You tube app.

But stuck with using the Youtube API. I have been in development field from last 6 Months. Don't know, Javascript and other.

I read Youtube Api documentation(As, I couldn't find useful to play youtube videos on Google. as there some changes in the api implementation after aouth 2.0 , and all code are prior 5.0 on internet ).

And whatever I read in the Youtube API DOCS, I believe I understood only 30-40% (may be because I never did my hands dirty with any other APIs or may be I don't know what exactly to use from API Documents) .

I read few things about iframe. But Dont know How exactly to use them.

Please, If any body has gone through the same problem, Then please guide me. Feels like Hell from Last 2 days.


回答1:


To play YouTube videos in your iOS app use these steps:

  1. Add MediaPlayer framework in your XCode project.
  2. Import MediaPlayer.h in your class.
  3. Use below code to play video.

    MPMoviePlayerViewController *movieController=[[MPMoviePlayerViewController alloc]initWithContentURL:VideoUrl];
    
    [self presentMoviePlayerViewControllerAnimated:movieController];
    
    [movieController.moviePlayer play];
    



回答2:


You can use UIWebView to play youtube videos in ypur app .



来源:https://stackoverflow.com/questions/22498721/integration-of-youtube-in-my-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!