because in the next section we need to introduce the multi-scene switching function, so in this chapter we create a new scenario, such as
rewriteNvsceneplayThe life cycle
1. reference header file #import ' NVVideoWidget.h '
2, in the onCreate method Instance session video control
Code:
Video = [[Nvvideowidget alloc] initwithsceneplay:self widgetname:@ "Video_widget"]; Add a video path, either a local path or a URL (on demand, live) [Video Setvideopath:[nsurl urlwithstring:@] http://221.228.226.23/11/t/j/v/b/ Tjvbwspwhqdmgouolposcsfafpedmb/sh.yinyuetai.com/691201536ee4912bf7e4f1e2c67b8119.mp4 "]; Set coordinates [Video setposition:nvposition (0.0, 0.5, 0.0)]; Set the scale [Video setscale:nvposition (8.0, 1.0, 6.0)]; [Self addwidget:video]; Video preparation [videos prepare];
in theOnresumemethod to play the video
in theOnPausepause Video in method
in theOnStopmethod to stop the video
in theondestorymethod to destroy the video
3. Add Videoscene class in nvisioncontroller.m
Reference header File#import ' VideoScene.h '
Set the startup scene toVideosceneand WillMyfirstscenecomments, such as:
Code:
Videoscene *videoscene = [[Videoscene alloc] initwithname:@ "Video_scene"]; [[Nvappdirector Sharednvappdirector] addsceneplay:@ "Main_sceneplay" scene:videoscene];
To run the project:
Nvisionxr_ios Tutorial 10--Loading video controls