簡體   English   中英

如何在iOS應用程序中添加Kaltura Player

[英]How add Kaltura Player in iOS application

我嘗試在我的iOS應用程序中添加Kaltura Player。 我已經閱讀了本文檔中的示例( http://knowledge.kaltura.com/kaltura-player-sdk-ios ),但對我而言,它們不起作用,bcs KPViewController尚未使用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

我究竟做錯了什么?

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方法具有播放視頻的實現。

您確定要導入KPViewController,因為它具有自定義的初始化程序initWithURL:。 另外,KPViewController沒有任何播放器屬性(至少不是公共屬性)。 播放器(id)由KPlayerController延遲創建(它也不是KPViewController的公共屬性)。 所以您的實現對我來說聽起來很糟糕:-)(很抱歉說:-))。 需要查看更多內容才能正確回答。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM