diff --git a/cocos/ui/UIVideoPlayer-ios.mm b/cocos/ui/UIVideoPlayer-ios.mm index c5e599bfca..7acba78890 100644 --- a/cocos/ui/UIVideoPlayer-ios.mm +++ b/cocos/ui/UIVideoPlayer-ios.mm @@ -134,8 +134,9 @@ using namespace cocos2d::experimental::ui; } if (videoSource == 1) { - self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@(videoUrl.c_str())]] autorelease]; + self.moviePlayer = [[[MPMoviePlayerController alloc] init] autorelease]; self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; + [self.moviePlayer setContentURL:[NSURL URLWithString:@(videoUrl.c_str())]]; } else { NSString *path = [UIVideoViewWrapperIos fullPathFromRelativePath:@(videoUrl.c_str())]; self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:path]] autorelease]; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp index 31e9e299da..90f6e77ea1 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp @@ -104,7 +104,7 @@ void VideoPlayerTest::menuOnlineVideoCallback(Ref* sender) { if (_videoPlayer) { - _videoPlayer->setURL("http://video001.smgbb.cn/gslb/program/FDN/FDN1190949/HLSVodService.m3u8?_mdCode=6065719&_cdnCode=B2B_XL_TEST&_type=0&_rCode=TerOut_18865&_userId=020341000456068&_categoryCode=SMG_HUAYU&_categoryPath=SMG_1002,SMG_HUAYU,&_adPositionId=01001000&_adCategorySource=0&_flag=.m3u8&_enCode=m3u8&taskID=ysh_ps_002-ott_1397459105893_020341000456068&_client=103&_cms=ctv&_CDNToken=76C043FD4969501754DC19E54EC8DC2C"); + _videoPlayer->setURL("http://benchmark.cocos2d-x.org/cocosvideo.mp4"); _videoPlayer->play(); } }