-
Notifications
You must be signed in to change notification settings - Fork 286
Closed
Description
What version of Streaming-Meda-Cordova-Plugin are you using?
v0.1.4
What version of Cordova are you using?
6.5.0
What devices are affected?
Android, IOS
Please describe the issue in detail, with relevant code samples
When I use api playVideo(url), I got an error: Media Player Error: Unknown(1) - 1005
.
the url is like http://xxx:3000/测试.mp4
, then I found the problem is caused because of the Chinese characters
Android
I supposed to modify the SimpleVideoStream.java
using Uri.encode()
to format the video url;
private void play() {
mProgressBar.setVisibility(View.VISIBLE);
mVideoUrl = Uri.encode(mVideoUrl, ":/-![].,%?&=");
Uri videoUri = Uri.parse(mVideoUrl);
try {
mVideoView.setOnCompletionListener(this);
mVideoView.setOnPreparedListener(this);
mVideoView.setOnErrorListener(this);
mVideoView.setVideoURI(videoUri);
mMediaController = new MediaController(this);
mMediaController.setAnchorView(mVideoView);
mMediaController.setMediaPlayer(mVideoView);
if (!mControls) {
mMediaController.setVisibility(View.GONE);
}
mVideoView.setMediaController(mMediaController);
} catch (Throwable t) {
Log.d(TAG, t.toString());
}
}
IOS
I supposed to modify the StreamingMedia.m
-(void)startPlayer:(NSString*)uri {
NSString *utf8Uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:utf8Uri];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
.....
}
p.s : I know that Chinese characters should not normally be included in video urls...
Activity
shamilovtim commentedon Jun 25, 2018
too much of an edge case for now