How does instagram and vine iOS apps play videos inline? [closed]

拜拜、爱过 提交于 2019-12-18 13:27:00

问题


Without opening the fullscreen video player?

Are they using a webview? What is the format of the video?


回答1:


I inspected Instagram app using Reveal and looks like they use an AVPlayer, which makes them able to customize it more than if they were using an UIWebView or MPMoviePlayerController.




回答2:


use/try below code it's works i hoped.

NSString *embedHTML = @"\
  <html><head>\
  <style type=\"text/css\">\
  body {\
  background-color: transparent;
  color: white;
  }\
  </style>\
  </head><body style=\"margin:0\">\
  <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
  width=\"%0.0f\" height=\"%0.0f\"></embed>\
  </body></html>";

  NSString *htmlString = [NSString stringWithFormat:embedHTML, yourURLString, width,height];//set width and height 

  [webView loadHTMLString:htmlStr baseURL:nil];
  [self.view addSubview:webView];

or

use try second approach via UIWebView class delegates method

allowsInlineMediaPlayback



来源:https://stackoverflow.com/questions/20929380/how-does-instagram-and-vine-ios-apps-play-videos-inline

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