Can you try using the method below to convert the relative url to an absolute one?
function relativeToAbsolute(url) { if (/^(+:)?\/\//i.test(url)) { // URL contains protocol and can be considered absolute return url; }
// get protocol var protocol = document.baseURI.substring(0, document.baseURI.indexOf('/') + 2); var uri = document.baseURI.substring(document.baseURI.indexOf('/') + 2);
// remove trailing file (edge case, this is just a domain e.g. // www.google.com) uri = uri.substring(0, uri.lastIndexOf('/') + 1);
var baseUrl = protocol + uri; if (baseUrl !== '/') baseUrl += '/';
still not working check attached imagerecognition.js if missing anything ??
W
Wolfgang Damm
said
almost 10 years ago
okay, I quickly scanned your code and it looks good. Can you try opening the same file in the android browser to see if it is able to play the video (could be a codec problem)?
Additionally can you send us a download link to the file so we can try it out on our end?
For further testing it would be great to know the exact android version you tried this on? Have you tried it on different devices?
Have to tried to play and video from assest folder of apk ??
M
Markus Eder
said
almost 10 years ago
Hi There!
As it is right now the AR.context.startVideoPlayer method is aimed at displaying videos from external URLs that reside on an external webserver. For local resources as in your case in the assets folder this might cause some problems.
So if that constitutes a possibility for you, the fastest way for you would be to load your video file on a webserver and use that as input for the AR.context.startVideoPlayer method.
Another maybe more flexible solution would be to write your own VideoPlayer activity in java and design it upon your needs. As this activity only consists of a few components this task should not be to lengthy. The ApiDemos project that ships with your Android SDK (Path: YOUR_ANDROID_SDK_FOLDER/sdk/samples/API_LEVEL/ApiDemos) should give you a very good starting point to quickly complete that task. Specificly the MediaPlayerDemo_Video.java and VideoViewDemo.java classes should be very helpful.
This activity can then be triggered via the ArchitectUrlListener class of the Wikitude SDK. With that listener you can react to events that happen in Javascript in your native Android activity (More detailed information can be found in our Android Wikitude SDK documentation).
As an example, in your ARchitect world you could then write
gaurav mishra