1. 찾아보니 WaveSurfer는 http or https를 통해서 동작을 하면서도 blob 타입의 데이터를 재생할 수 있네요.
오디오 파일을 blob 타입(base64 문자열)으로 가지고 있으면 재생이 가능합니다.
ㄱ. php나 다른 방식을 알고 계시면 음성 파일을 base64로 변환하고
ex) php 로 변환할경우에
<?php
$tmp_name = "001z.mp3";
$fp = fopen($tmp_name, 'rb');
$file_content = file_get_contents($tmp_name);
?>
<?= base64_encode($file_content)?>
ㄴ. 문자열을 복사하신 다음. 안드로이드에서 html에서
<div id="waveform"></div>
<script src="wavesurfer.js"></script>
<script>
var waveSurfer = WaveSurfer.create({
container: '#waveform',
waveColor: 'violet',
progressColor: 'purple' });
//wavesurfer.load('001z.mp3');
var myAudio = "data:audio/x-wav;base64,blob데이터"; // enter complete blob data. I have removed it since it was not allowing to paste me completely
waveSurfer.load(myAudio);
waveSurfer.on('ready', function() {
waveSurfer.play();
});
</script>
이렇게 하시면 재생가능합니다.
2. LinearLayout으로 weight를 이용하시면 webview를 가변으로 만들어 볼수 있습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:background="#ff00ff"
android:layout_width="match_parent"
android:layout_height="200dp"/>
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp">
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<Button
android:text="버튼"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>