0

我尝试在我的 iOS 应用程序中添加 Kaltura Player。我已经阅读了本文档( http://knowledge.kaltura.com/kaltura-player-sdk-ios )中的示例,但是对我来说,它们不起作用,bcsKPViewController没有方法initWithURL。所以,我在viewDidAppear方法中这样做

if ( self.KPlayer == nil ) 
{
    self.KPlayer = [[KPViewController alloc] init];
    [self.KPlayer.player setContentURL:fileURL];
    [self.KPlayer.player play];
    [self presentViewController:self.KPlayer animated:YES completion:nil];
}

但视频未显示,在日志中我收到一条消息:

::Error:: -[KPViewController viewDidAppear:] (line:168) 
Delegate MUST be set and respond to selector -getInitialKIframeUrl

我究竟做错了什么?

4

2 回答 2

1

Kaltura SDK for iOS 和 Android 中有更新,到目前为止他们在文档中没有更改/更新。:

根据旧 SDK,KPViewController 中有方法 initWithUrl,您可以使用以下方法播放视频:

NSString *videoUrl = [NSString stringWithFormat:@"https://cdnapisec.kaltura.com/p/243342/sp/24334200/embedIframeJs/uiconf_id/12905712/partner_id/1988382?iframeembed=true&entry_id=%@",entryId];
    NSURL *url = [NSURL URLWithString:videoUrl];

    self.player = [[KPViewController alloc] initWithURL:url];
    self.player.view.frame = [self.viewVideo bounds];
    [self.player loadPlayerIntoViewController:self];
    [self.viewVideo addSubview:self.player.view];

但根据新的 SDK 和演示参考应用程序:https ://github.com/kaltura/IOSReferenceApp

install the SDK using pod :
1) on terminal,go to the Project Directory and run -> pod init
2) open the Podfile and copy and paste
 pod 'player-sdk-native-ios', '~> 1.1' 
before this line : target 'KalturaVideo_ObjC' do
close and save the file
3) pod install
4) close your current XCode project and open your ProjectName.xcworkspace file

MediaInfoViewController_iPhone.m 中有 - (void)drawPlayer 方法,它将 KPViewController* playerViewController 添加到 ViewController

以防万一您无法使用演示应用播放视频,请调用 [self playButtonPressed];在drawPlayer方法的最后,直接播放视频,playButtonPressed方法有播放视频的实现。

于 2015-09-02T07:03:02.003 回答
0

您确定要导入 KPViewController,因为它有一个自定义初始化程序 initWithURL:。此外,KPViewController 没有任何播放器属性(至少不是公共属性)。播放器 (id) 由 KPlayerController 延迟创建(这也不是 KPViewController 的公共属性)。所以你的实现对我来说听起来很糟糕:-)(很抱歉:-))。需要看更多才能正确回答。

于 2015-08-19T14:31:01.577 回答