I'm doing a tourist places with VR with No sounds and No transition to other image. One of my friend tell me its not user friendly if every time he wants to view other image he needed to remove the phone to VR BOX to view again and he added put sounds to make it realistic.
Help me guys on how to add audio and transition in com.google.vr.sdk.widgets.pano I have no any idea how to make this.
Fragment
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 File
<?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>