request of info: hoe to play video from local file system
elenaaralla opened this issue · 8 comments
Hi,
this is only a request of info, not an issue
in your example, when image is recognized, a sound was played; there is a way to play video saved locally on devices (under www folder)? I tried these plugins:
com.dawsonloudon.videoplayer (but works only for Android)
cordova-plugin-streaming-media (but doesn't work with local file)
I tried html5
Thank you,
elena.
Hi Elena,
You have two options with this, you can either:
- Write some platform-specific code to launch the video within Vuforia (not recommended)
- Use a plugin such as Device to detect which operating system your app is running on and then launch a plugin/video depending on the os and version.
I've previously played videos using point 2 from above, I've checked the OS and then the version, writing some code to play the video in whichever way works for that device.
I hope this helps?
Sorry,
I'm not able to add labels...thank you.
I've previously used https://github.com/jaeger25/Html5Video for Android video playback and some code like this:
// Get video
var videoObject = $('#MyVideo');
// If Android
if (device_platform == 'Android') {
var videoID = $(videoObject).attr('id'); // Get an ID to pass to the HTML5Video plugin
// Add a small delay of 100ms
setTimeout(function () {
window.plugins.html5Video.play(videoID) // Play the video using Android plugin
}, 100);
} else { // If iOS
videoObject.play(); // Play the video using standard HTML
}
// When the video finished
videoObject.onended = function (e) {
console.log('Finished video');
};
Hopefully this will all help 👍
Hi,
I'll try this code asap.
Have a nice day,
elena.
@elenaaralla - just a note, device_platform
is a variable that contains the output of device.platform
. See the Device plugin documentation here: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/#deviceplatform
@elenaaralla how did you get on?
I'm going to close this as off-topic - feel free to comment back though if you need any more help 😄