IJKPlayer结合MD360Player4iOS制作VR效果

/ 2评 / 1

想要这种效果就不能乱搞版本了,毕竟这一块东西不是自己写的,很容易出问题,所以要按照 MD360Player4iOS 作者的方法来选取版本编译IJKPlayer

1、克隆指定版本(**要看清楚**)

 git clone https://github.com/ashqal/ijkplayer.git ijkplayer-ios

2、切换相应的分支

cd ijkplayer-ios
git checkout -B latest k0.6.0

3、按照上篇文章修改shell脚本文件,修改源代码进行编译

4、可以看看作者的demo

git checkout MDExtDemo
cd ios/IJKMediaDemo/
pod update

demo代码很简单

#import "MDVRLibrary.h"

@interface IJKVideoViewController()
@property (nonatomic,strong) MDVRLibrary* vrLibrary;
@end

- (void)viewDidLoad{
    [super viewDidLoad];
    ...

    
    [self createVRLibrary];
}

- (void) createVRLibrary{
    /////////////////////////////////////////////////////// MDVRLibrary
    MDVRConfiguration* config = [MDVRLibrary createConfig];
    
    [config asVideoWithYUV420PProvider:[MDIJKAdapter wrap:self.player.view]]; // working with ijk
    [config setContainer:self view:self.view];
    
    // optional
    [config displayMode:MDModeDisplayNormal];
    [config interactiveMode:MDModeInteractiveTouch];
    [config pinchEnabled:true];
    
    self.vrLibrary = [config build];
    /////////////////////////////////////////////////////// MDVRLibrary
}

5、毕竟这些是别人做的,而且更新维护可能有限,提问可能也不会很及时回答,这方面还很空白,所以蒙眼走路肯定要踩坑,我这两天都被渲染大小闹得头疼,我有两个工程,一个使用的老版本pod,一个使用新的,老的一切正常,新的渲染出来的GLK总是比想要的大的多,没办法,把新工程下面写的代码拷贝到老工程中,小心翼翼的开发着,唉,坑多技术浅薄,无奈啊。。。

2条回应:“IJKPlayer结合MD360Player4iOS制作VR效果”

  1. 李景嗣说道:

    按照这种方式,播放放出来绿屏,是哪里还需要处理吗?

    • 随风说道:

      @李景嗣 这个原因很多,可能是编码问题,那就要看看ffmpeg编译的是不是有问题,也可以看一下https://github.com/libobjc/SGPlayer这个库,看看有没有绿屏的问题。