cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Getting Videos from Thingworx into Vuforia Studio

MA8731174
14-Alexandrite

Getting Videos from Thingworx into Vuforia Studio

Hello Community,

      I can say that it seems possible to get the videos saved which are saved in thingworx repository and show in vuforia studio on the video widget. There are 10 videos which i change with the click of a button. What do you think is a best solution that should i get the video on click everytime or first fetch all the videos together and then show it one by one with the button click. i mean store them as an array. Any suggestions in this regard...

 

Problem

 

 

let videos = [
    { id: 'video-2', src: 'app/resources/Uploaded/Illustration-1.mp4' },//1
    { id: 'video-2', src: 'app/resources/Uploaded/Illustration-2.mp4' },//2
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-3.mp4' },//3
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-5.mp4' },//4  
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-6.mp4' },//5
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-7.mp4' },//6
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-8.mp4' },//7
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-9.mp4' },//8 
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-10.mp4' },//9  
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-11.mp4' },//10 
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-13.mp4' },//11 
  	{ id: 'video-2', src: 'app/resources/Uploaded/Illustration-14.mp4' },//12 
];	

 

I have many experiences with different videos with different business logics and thats why i want to fetch videos dynamically from the back end. I have found the service below as you can see to get the binary data of the video but now even one clip which is of 35MB is taking 15 seconds to fetch from filerepository. any idea to make it fast or any other approach should i  have to consider here?

 

Jamal8548_0-1725274701515.png

 

@RolandRaytchev  any suggestions here?

 

4 REPLIES 4
MA8731174
14-Alexandrite
(To:MA8731174)

With LoadBinary service we can access videos/pvz files or anything... 

 

 $scope.serviceName='LoadBinary'
  $scope.repositoryThing='V2.FileRepository'


  //var parameters   =  {"path":"ML1/0011/1715682357732/1/03683147-Animation.pvz"} 
   var parameters   =  {"path":"ML1/0011/1715682357732/1/30122501_animation_matritze.pvz"} 
  
  // var parameters   =  {"path":"ML1/0011/1715682357732/1/20231205_Q-Gate_SVL_Stator_Med.pvz"}  ;  console.warn(parameters)
  twx.app.fn.triggerDataService($scope.repositoryThing,$scope.serviceName,JSON.parse(JSON.stringify( parameters)));
  $scope.$applyAsync();    
  
  console.log("after callLoadBinaryContent wdgName:"+$scope.wdgName)




$scope.$root.$on('LoadBinary-complete', function(event, args) { 
  console.log("LoadBinary-complete event");console.log("name="+event.name)
  console.warn(args.data[0].Content)
  
  
  
  let converted_file= 'data:video/mp4;base64,'+args.data[0].Content
  console.warn(converted_file)

 

Hi @MA8731174,


Thank you for your question!

Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.

Also, feel free to add any additional information you think might be relevant. 

 

Thanks for using the Community!

 

Best regards,

Catalina
PTC Community Moderator

Hi @MA8731174 ,

acctually I have also an issue with getting videos on the HoloLens 2 device via the LoadBinary. When I check the data is comming but it seems it could not be played because possibly it is not completed and is not syncronized , no idea at all.

I believe to remember that LoadBinaray is working on the IOS and Android device and  issue occurs only on HL2 device.

But possibly you can use the solution what was metnioned in the post How to attach a Thingworx Repository file to the Hololens Project 3D Video widge

It is more easy and I verified that was working fine on HoloLens 2 device. There you set the src to the completed TWX path what for example the TWX service  GetFileListingWithLinks will return  in the downloadLink field.

So, please, call GetFileListingWithLinks for the folder where you have the video soruces you want to use and then replace the src element in your videos json. That should work when the permission of the repository thing allows access. Please, refer to  https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FGrantUserPermissions.html  and https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FAnonymousAccess.html%23

 

the call of LoadBinary I was used in the past to get data from TWX file repository to mobile device. On mobile device is working but still I had no sucssess on HL2 device. So that you can use the alternative way with the downloadLink field./service   GetFileListingWithLinks . In my previous post I refered to  How to attach a Thingworx Repository file to the Hololens Project 3D Video widget  what was about getting video file on HoloLens device (that works also on mobile)

Now I tested with pvz file . And that works also fine. So means using a TWX downloadLink will work. That approach is much easy to hanlde and it makes the usage of the loadBinary unnecessary . If you want to know when the method is completed you can use for PVZ e.g. the event of the modelWidget $rootScope.$on("modelLoaded",function() {....}) So tested with a Repository list and the loading of the pvz models was working fine. /on HL and mobile

2024-11-08_18-04-07.jpg

and used some code like thatbelow. So when clicked on the 3D Widget it change the model with the next model of the json list.

 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
$scope.populateModelList = function() {

$scope.app.params.myList = [
{
display: "3dgauge1",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/3dgauge1.pvz"
},
{
display: "engine_test_exp",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/engine_test_exp.pvz"
},
{
display: "mill5MT_High",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/mill5MT_High.pvz"
},
{
display: "bla-bla->the same as 3dauge1",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/bla-bla.pvz"
},
{
display: "navipad",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/navipad.pvz"
},
{
display: "Ventil BG",
value: "/Thingworx/FileRepositories/CADRepository1_test/pvz/ventil_bg_anno.pvz"
}
];

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
angular.element(document).ready(function() { 
       $scope.populateModelList();
  
  $scope.app.numberArr=JSON.parse(JSON.stringify($scope.app.params.myList)).length
   $scope.app.countArr=0
})

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
$scope.app.modelWdgSet= function () {
$scope.view.wdg['model-1']['src']= JSON.parse(JSON.stringify(($scope.app.params.myList)))[$scope.app.countArr].value;
$scope.view.wdg['3DLabel-2']['text']= JSON.parse(JSON.stringify(($scope.app.params.myList)))[$scope.app.countArr].display;
 
$scope.$applyAsync();
$scope.app.countArr++;
  if( $scope.app.countArr >= $scope.app.numberArr)  $scope.app.countArr=0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

Announcements

Top Tags