Skip to content

Media Player Error: Unknown(1) - 1005 #96

@monkeyDledger

Description

@monkeyDledger

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

shamilovtim commented on Jun 25, 2018

@shamilovtim
Collaborator

too much of an edge case for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shamilovtim@monkeyDledger

        Issue actions

          Media Player Error: Unknown(1) - 1005 · Issue #96 · nchutchind/cordova-plugin-streaming-media