0
我的媒體錄像機正在錄製視頻後錄製視頻,我正在預覽我的視頻(很好)。 現在已將此視頻上傳到本地http服務器。 並最終從服務器獲取此視頻播放,但它顯示無法播放視頻。從服務器下載後無法播放視頻
任何建議,其中實際的錯誤是... thanx的幫助。
MediaRecorder
this.mediaRecorder = new MediaRecorder(); this.mediaRecorder.setCamera(this.camera); camera.unlock(); this.mediaRecorder.setCamera(camera); this.mediaRecorder.setOrientationHint(90); this.mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); this.mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); CamcorderProfile camcorderProfile_HQ = CamcorderProfile.get(CamcorderProfile.QUALITY_480P); this.mediaRecorder.setProfile(camcorderProfile_HQ); this.mediaRecorder.setOutputFile(this.initFile().getAbsolutePath()); this.mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec. this.mediaRecorder.setMaxFileSize(5000000); this.mediaRecorder.setPreviewDisplay(this.cameraPreview.getHolder().getSurface()); try { this.mediaRecorder.prepare(); // start the actual recording // throws IllegalStateException if not prepared this.mediaRecorder.start(); Toast.makeText(this, R.string.recording, Toast.LENGTH_SHORT).show(); // enable the stop button by indicating that we are recording this.toggleButtons(true); } catch (Exception e) { Log.wtf(TAG, "Failed to prepare MediaRecorder", e); Toast.makeText(this, R.string.cannot_record, Toast.LENGTH_SHORT).show(); this.releaseMediaRecorder(); }
視頻視圖
Uri uri = Uri.parse("/data/data/com.example.mediarecorder/files/"+ messageList.get(position)); //do not add any extension video.setVideoURI(uri); video.requestFocus(); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); video.setKeepScreenOn(true); System.out.println(uri + " "+ uri.getEncodedAuthority()+ " "+ uri.decode(data_type) + " "+ uri.getUserInfo() + " "+ uri.describeContents()); video.start();
其實我忘了提,我上傳視頻到http服務器(filezila)和我後我正在解析uri。 它是在如Nexus 5更高版本設備的但不是在其他設備,諸如karbon和星系標籤運行。 @Sunny –