我正在做VR的旅游场所没有声音,没有过渡到其他图像。我的一位朋友告诉我,如果每次他想要查看其他图像,他需要将手机移至VR BOX以便再次查看,并且他添加了放置声音以使其变得逼真,那么它不是用户友好的。
请教我们如何在com.google.vr.sdk.widgets.pano中添加音频和转换。我不知道如何制作此内容。
片段
public class TW1 extends Fragment {
private VrPanoramaView panoWidgetView;
private ImageLoaderTask backgroundImageLoaderTask;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_tw1, container,false);
panoWidgetView = (VrPanoramaView) v.findViewById(R.id.pano_view);
return v;
}
@Override
public void onPause() {
panoWidgetView.pauseRendering();
super.onPause();
}
@Override
public void onResume() {
panoWidgetView.resumeRendering();
super.onResume();
}
@Override
public void onDestroy() {
panoWidgetView.shutdown();
super.onDestroy();
}
private synchronized void loadPanoImage() {
ImageLoaderTask task = backgroundImageLoaderTask;
if (task != null && !task.isCancelled()) {
task.cancel(true);
}
VrPanoramaView.Options viewOptions = new VrPanoramaView.Options();
viewOptions.inputType = VrPanoramaView.Options.TYPE_STEREO_OVER_UNDER;
String panoImageName = "tw1.jpg";
task = new ImageLoaderTask(panoWidgetView, viewOptions, panoImageName);
task.execute(getActivity().getAssets());
backgroundImageLoaderTask = task;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
loadPanoImage();
}
}
xml文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="#ffffff">
<TextView
android:id="@+id/welcome_title"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight=".2"
android:text="@string/chocolate_hills"
android:textAlignment="center"
android:textStyle="bold"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceLarge" />
<com.google.vr.sdk.widgets.pano.VrPanoramaView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:id="@+id/pano_view"
android:layout_margin="5dip"
android:scrollbars="none"
android:contentDescription="@string/codelab_img_description" />
<TextView
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight=".2"
android:text="@string/chocolate_hills_location"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_weight="1"
android:text="@string/chocolate_hills_desc"
android:textColor="#000000"/>
</LinearLayout>