aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-07-01 20:25:35 +0100
committerJustin Clark-Casey (justincc)2010-07-26 23:34:18 +0100
commit4ebae14a530f8f5909e93a0dd852297f4f30a736 (patch)
tree4084b56944c7a2b127e336ba533555295c87cc50
parentsend a full object update out to avatars when a media texture is initially set (diff)
downloadopensim-SC_OLD-4ebae14a530f8f5909e93a0dd852297f4f30a736.zip
opensim-SC_OLD-4ebae14a530f8f5909e93a0dd852297f4f30a736.tar.gz
opensim-SC_OLD-4ebae14a530f8f5909e93a0dd852297f4f30a736.tar.bz2
opensim-SC_OLD-4ebae14a530f8f5909e93a0dd852297f4f30a736.tar.xz
handle ObjectMediaNavigateMessage
Other avatars can now see the webpages that you're navigating to. The requirement for an initial prim click before the texture displayed has gone away. Flash (e.g. YouTube) appears to work fine. Still not persisting any media data so this all disappears on server restart
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs69
1 files changed, 55 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 0d31732..c3ec2a6 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -96,7 +96,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
96 // We do get these posts when the url has been changed. 96 // We do get these posts when the url has been changed.
97 // Even though we're registering for POST we're going to get GETS and UPDATES too 97 // Even though we're registering for POST we're going to get GETS and UPDATES too
98 caps.RegisterHandler( 98 caps.RegisterHandler(
99 "ObjectMediaNavigate", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaNavigateRequest)); 99 "ObjectMediaNavigate", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaNavigateMessage));
100 } 100 }
101 101
102 /// <summary> 102 /// <summary>
@@ -128,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
128 omm.Request.GetType())); 128 omm.Request.GetType()));
129 } 129 }
130 130
131 /// <summary>
132 /// Handle a request for media textures
133 /// </summary>
134 /// <param name="omr"></param>
135 /// <returns></returns>
131 protected string HandleObjectMediaRequest(ObjectMediaRequest omr) 136 protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
132 { 137 {
133 //UUID primId = (UUID)osdParams["object_id"]; 138 //UUID primId = (UUID)osdParams["object_id"];
@@ -138,8 +143,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
138 if (null == part) 143 if (null == part)
139 { 144 {
140 m_log.WarnFormat( 145 m_log.WarnFormat(
141 "[MOAP]: Received a GET ObjectMediaRequest for prim {0} but this doesn't exist in the scene", 146 "[MOAP]: Received a GET ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
142 primId); 147 primId, m_scene.RegionInfo.RegionName);
143 return string.Empty; 148 return string.Empty;
144 } 149 }
145 150
@@ -176,6 +181,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
176 return rawResp; 181 return rawResp;
177 } 182 }
178 183
184 /// <summary>
185 /// Handle an update of media textures.
186 /// </summary>
187 /// <param name="omu">/param>
188 /// <returns></returns>
179 protected string HandleObjectMediaUpdate(ObjectMediaUpdate omu) 189 protected string HandleObjectMediaUpdate(ObjectMediaUpdate omu)
180 { 190 {
181 UUID primId = omu.PrimID; 191 UUID primId = omu.PrimID;
@@ -185,8 +195,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
185 if (null == part) 195 if (null == part)
186 { 196 {
187 m_log.WarnFormat( 197 m_log.WarnFormat(
188 "[MOAP]: Received am UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in the scene", 198 "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
189 primId); 199 primId, m_scene.RegionInfo.RegionName);
190 return string.Empty; 200 return string.Empty;
191 } 201 }
192 202
@@ -203,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
203 { 213 {
204 string rawVersion = part.MediaUrl.Substring(5, 10); 214 string rawVersion = part.MediaUrl.Substring(5, 10);
205 int version = int.Parse(rawVersion); 215 int version = int.Parse(rawVersion);
206 part.MediaUrl = string.Format("x-mv:{0:10D}/{1}", version, UUID.Zero); 216 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
207 } 217 }
208 218
209 m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); 219 m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
@@ -223,19 +233,50 @@ namespace OpenSim.Region.CoreModules.Media.Moap
223 /// <param name="httpRequest">/param> 233 /// <param name="httpRequest">/param>
224 /// <param name="httpResponse">/param> 234 /// <param name="httpResponse">/param>
225 /// <returns></returns> 235 /// <returns></returns>
226 protected string HandleObjectMediaNavigateRequest( 236 protected string HandleObjectMediaNavigateMessage(
227 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 237 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
228 { 238 {
229 m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request for {0}", path); 239 m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
230 //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); 240
241 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
242 ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
243 omn.Deserialize(osd);
244
245 UUID primId = omn.PrimID;
246
247 SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
248
249 if (null == part)
250 {
251 m_log.WarnFormat(
252 "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
253 primId, m_scene.RegionInfo.RegionName);
254 return string.Empty;
255 }
256
257 m_log.DebugFormat(
258 "[MOAP]: Updating media entry for face {0} on prim {1} {2} to {3}",
259 omn.Face, part.Name, part.UUID, omn.URL);
260
261 MediaEntry me = part.Shape.Media[omn.Face];
262 me.CurrentURL = omn.URL;
263
264 string oldMediaUrl = part.MediaUrl;
265
266 // TODO: refactor into common method
267 string rawVersion = oldMediaUrl.Substring(5, 10);
268 int version = int.Parse(rawVersion);
269 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
270
271 m_log.DebugFormat(
272 "[MOAP]: Updating media url in prim {0} {1} from [{2}] to [{3}]",
273 part.Name, part.UUID, oldMediaUrl, part.MediaUrl);
274
275 part.ScheduleFullUpdate();
231 276
232 // TODO: Persist in memory
233 // TODO: Tell other agents in the region about the change via the ObjectMediaResponse (?) message
234 // TODO: Persist in database 277 // TODO: Persist in database
235 278
236 return string.Empty; 279 return string.Empty;
237 } 280 }
238
239
240 } 281 }
241} \ No newline at end of file 282} \ No newline at end of file