How to use b64EncodedValue method in apickli

Best JavaScript code snippet using apickli

playreadyplay.js

Source:playreadyplay.js Github

copy

Full Screen

1//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF2//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO3//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A4//// PARTICULAR PURPOSE.5////6//// Copyright (c) Microsoft Corporation. All rights reser7function PlayReadyPlay(VideoIndex) {8 this.videoIndex = VideoIndex;9 this.contentInfo;10 this.mediaPlayer;11 this.proactiveServiceRequest;12}13//14PlayReadyPlay.prototype = {15 //call this before call others16 initialize: function (ContentInfo) {17 this.setMediaPlayer();18 this.setContentInfo(ContentInfo);19 },20 uninitilize: function () {21 var videotag = 'video' + this.videoIndex;22 var videoElement = document.getElementById(videotag);23 videoElement.pause();24 videoElement.msSetMediaProtectionManager(null);25 videoElement.removeAttribute("src");26 videoElement.load();27 if (this.mediaPlayer !== undefined) {28 this.mediaPlayer.mediaProtectionManager.removeEventListener("servicerequested", this.mediaPlayer.serviceRequest);29 this.mediaPlayer = null;30 }31 },32 setContentInfo: function (ContentInfo) {33 logMsg('setContentInfo');34 this.contentInfo = ContentInfo;35 this.contentInfo.actualLaurl = ContentInfo.laurl;36 },37 HideVideos: function () {38 var selectMediaFile = 'selectMediaFile' + this.videoIndex;39 document.getElementById(selectMediaFile).value = document.getElementById(selectMediaFile).options[0];40 document.getElementById(selectMediaFile).style.visibility = "hidden";41 var videotag = 'video' + this.videoIndex;42 document.getElementById(videotag).style.visibility = "hidden";43 document.getElementById(videotag).removeAttribute('src');44 },45 ShowVideos: function () {46 var selectMediaFile = 'selectMediaFile' + this.videoIndex;47 document.getElementById(selectMediaFile).style.visibility = "visible";48 var videotag = 'video' + this.videoIndex;49 document.getElementById(videotag).style.visibility = "visible";50 },51 setSource: function () {52 logMsg('(setSource)this.videoIndex = ' + this.videoIndex);53 logMsg('set source for video[' + this.videoIndex + ']');54 if (cbOptOutHWDRM.checked) {55 logMsg(' ');56 logMsg('!!!!! using SWDRM !!!!!');57 }58 var videotag = 'video' + this.videoIndex;59 //60 // In order to play Smooth Streaming content (e.g. PIFF_SuperSpeedway_720.ism at61 // http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism/Manifest)62 // you need to add Microsoft Universal Smooth Streaming Client SDK to the project's References.63 // If you haven't installed the SDK, you can download and install the SDK from64 // https://visualstudiogallery.msdn.microsoft.com/1e7d4700-7fa8-49b6-8a7b-8d8666685459?SRC=Home.65 // Also add Visual C++ 2015 Runtime for Universal Windows Platform Apps to the project's References66 // if it hasn't been added.67 //68 document.getElementById(videotag).src = this.contentInfo.content;69 },70 setIndividualOPLvalue: function (oplType, oplValueTagId) {71 var list = document.getElementById(oplValueTagId);72 var oplValue = parseInt(list.value, 10);73 if (!isNaN(oplValue)) {74 this.contentInfo.actualLaurl += "&" + oplType + "=" + oplValue;75 }76 },77 setOPLvalue: function () {78 //check if any OPL value should be set?79 this.setIndividualOPLvalue('UncompressedDigitalVideoOPL', 'selectVideoOPLValue');80 this.setIndividualOPLvalue('CompressedDigitalVideoOPL', 'selectVideoOPLValue2');81 this.setIndividualOPLvalue('AnalogVideoOPL', 'selectVideoOPLValue3');82 this.setIndividualOPLvalue('UncompressedDigitalAudioOPL', 'selectAudioOPLValue');83 this.setIndividualOPLvalue('CompressedDigitalAudioOPL', 'selectAudioOPLValue2');84 },85 setLicenseSurityLevel: function () {86 var licSLValue = document.getElementById('SetLicenseSecurityLevel').value;87 if (licSLValue != undefined) {88 this.contentInfo.actualLaurl += "&" + "SecurityLevel=" + licSLValue;89 }90 },91 setSecureStop: function () {92 if(this.contentInfo.secureStopCertFile != 'null') {93 this.contentInfo.actualLaurl += "&" + "SecureStop=1";94 }95 },96 setupPlayEnabler: function () {97 //check if PlayEnabler should be set for license?98 var PlayEnablerGUID = document.getElementById('selectPlayEnablerGUIDList').value;99 if (PlayEnablerGUID != 'None') {100 var enablerGUIDStr = "&PlayEnablers=" + g_PlayEnablerGUIDList[PlayEnablerGUID];101 this.contentInfo.actualLaurl += enablerGUIDStr;102 }103 },104 setExplicitGuids: function () {105 var guidIdx = 0;106 if (cbSCMS.checked) {107 guidIdx = parseInt(cbSCMS.value, 10);108 this.setExplicitGuid(guidIdx);109 }110 if (cbDigitalToken.checked) {111 guidIdx = parseInt(cbDigitalToken.value, 10);112 this.setExplicitGuid(guidIdx);113 }114 if (cbMAX_VGA_RESOLUTION.checked) {115 guidIdx = parseInt(cbMAX_VGA_RESOLUTION.value, 10);116 this.setExplicitGuid(guidIdx);117 }118 if (cbMAX_COMPONENT_RESOLUTION.checked) {119 guidIdx = parseInt(cbMAX_COMPONENT_RESOLUTION.value, 10);120 this.setExplicitGuid(guidIdx);121 }122 if (cbCGMS_A.checked) {123 guidIdx = parseInt(cbCGMS_A.value, 10);124 this.setExplicitGuid(guidIdx);125 }126 if (cbBesteffortCGMS_A.checked) {127 guidIdx = parseInt(cbBesteffortCGMS_A.value, 10);128 this.setExplicitGuid(guidIdx);129 }130 if (cbAGCColorStrip.checked) {131 guidIdx = parseInt(cbAGCColorStrip.value, 10);132 this.setExplicitGuid(guidIdx);133 }134 if (cbHDCPType1.checked) {135 guidIdx = parseInt(cbHDCPType1.value, 10);136 this.setExplicitGuid(guidIdx);137 }138 var maxResDecoderWidth = parseInt(ipMaxResDecorderWidth.value, 10);139 var maxResDecoderHeight = parseInt(ipMaxResDecorderHeight.value, 10);140 141 if (isNaN(maxResDecoderWidth) != isNaN(maxResDecoderHeight)) {142 var md = new Windows.UI.Popups.MessageDialog("You have to specify both the width and height! Ignore the incomplete max. resolution decoder.");143 md.showAsync();144 } else if(maxResDecoderWidth > 0 && maxResDecoderHeight > 0) {145 var baWidth = convertNumberTo4ByteArrayInNetworkOrder(maxResDecoderWidth);146 var baHeight = convertNumberTo4ByteArrayInNetworkOrder(maxResDecoderHeight);147 var bcWH = baWidth.concat(baHeight);148 // The 9th element in g_explicitGuidList is DigitV:MaxResDecoder (see contentInfo.json)149 var explicitGuidSetting = "&" + g_explicitGuidList[9].guidType +150 "=" + g_explicitGuidList[9].guid;151 var b64EncodedValue = encode(bcWH);152 explicitGuidSetting += ";" + b64EncodedValue;153 this.contentInfo.actualLaurl += explicitGuidSetting;154 }155 },156 setExplicitGuid: function (guidIndex) {157 var explicitGuidSetting = "&" + g_explicitGuidList[guidIndex].guidType +158 "=" + g_explicitGuidList[guidIndex].guid;159 var valuestr = g_explicitGuidList[guidIndex].defaultValue;160 var valueArr = valuestr.split(";");161 var byteValue = [];162 var byteValues;163 for (var idx = 0; idx < valueArr.length; idx++) {164 var x = parseFloat(valueArr[idx]);165 var i = 1;166 if (g_byteOneExplicitGuidList.indexOf(g_explicitGuidList[guidIndex].guid) == -1) {167 i = 4;168 }169 byteValue[idx] = getIntBytes(x, i);170 }171 if (valueArr.length == 1) {172 byteValues = byteValue[0];173 }174 else if (valueArr.length == 2) {175 byteValues = byteValue[1].concat(byteValue[0]);176 }177 else {178 logException('error(setExplicitGuid)', 'unexpected value');179 }180 var b64EncodedValue = encode(byteValues);181 explicitGuidSetting += ";" + b64EncodedValue;182 this.contentInfo.actualLaurl += explicitGuidSetting;183 },184 setInMemeryOrPersistentLicense: function () {185 logMsg('(setInMemeryOrPersistentLicense)this.videoIndex = ' + this.videoIndex);186 //check if generating a non-persistent license?187 if (!cbPersistentLicense.checked) {188 this.contentInfo.actualLaurl += "&UseSimpleNonPersistentLicense=1";189 }190 },191 setBoundToDomain: function () {192 //check if generating Domain-bound license?193 if (cbBoundToDomain.checked) {194 this.contentInfo.actualLaurl += "&UseDomains=1";195 }196 },197 setContentKey: function () {198 if (this.contentInfo.contentKey != 'null') {199 this.contentInfo.actualLaurl += "&ContentKey=" + this.contentInfo.contentKey;200 }201 },202 setFirstPlayExpiration: function () {203 if (this.contentInfo.firstPlayExpiration != 'null') {204 this.contentInfo.actualLaurl += "&RealTimeExpiration=1" + "&FirstPlayExpiration=" + this.contentInfo.firstPlayExpiration;205 }206 },207 setUplinkKey: function () {208 if (this.contentInfo.uplinkKey != 'null') {209 base64UplinkKid = guid_to_base64(this.contentInfo.uplinkKey, true);210 logMsg("base64UplinkKid=" + base64UplinkKid);211 this.contentInfo.actualLaurl += "&UseChainLicense=1" + "&UplinkKey=" + base64UplinkKid;212 }213 },214 setUseRootLicense: function () {215 this.contentInfo.actualLaurl += "&UseRootLicense=1";216 },217 setLicenseRights: function (f_bFirstPlayExpiration) {218 //219 // This test sample uses our custom DirectTap LicenseServer business logic to acquire 220 // specific licenses with particular property. Your license server might have different logic.221 // To find out what the properties in this page are and what they are used for, consult our222 // compliance rule in https://www.microsoft.com/playready/licensing/compliance/223 //224 var urlPattern = /\bhttp:\/\/playready.directtaps.net\/svc/gi;225 if (urlPattern.test(this.contentInfo.actualLaurl)) {226 //this cofiguration is for DTAP only227 this.setContentKey();228 this.setInMemeryOrPersistentLicense();229 this.setOPLvalue();230 this.setupPlayEnabler();231 this.setExplicitGuids();232 this.setBoundToDomain();233 this.setLicenseSurityLevel();234 this.setSecureStop();235 if (f_bFirstPlayExpiration != undefined &&236 f_bFirstPlayExpiration == true) {237 this.setFirstPlayExpiration();238 }239 }240 else {241 logMsg('not use DTAP server');242 }243 },244 proactivePlay: function (f_bFirstPlayExpiration) {245 logMsg('pre-acquire License(s), then playback');246 var proactiveServiceRequest = new ProactiveServiceRequest(this.videoIndex, this.contentInfo);247 var that = this;248 if (this.contentInfo.uplinkKey != undefined &&249 this.contentInfo.uplinkKey != "null") {250 var acquireLeafLicense = function () {251 that.setContentInfo(that.contentInfo);252 proactiveServiceRequest.proactiveLicenseAcquistion(function () {253 if (proactiveServiceRequest.licenseSession !== undefined) {254 proactiveServiceRequest.configMediaProtectionManager(that.mediaPlayer.mediaProtectionManager);255 }256 that.setSource();257 }, f_bFirstPlayExpiration);258 };259 proactiveServiceRequest.proactiveIndivChain(function () {260 proactiveServiceRequest.proactiveLicenseAcquistion(function () {261 that.proactiveServiceRequest = proactiveServiceRequest;262 acquireLeafLicense();263 }, null, that.contentInfo.uplinkKey);264 });265 }266 else {267 proactiveServiceRequest.proactiveIndivChain(function () {268 proactiveServiceRequest.proactiveLicenseAcquistion(function () {269 if (proactiveServiceRequest.licenseSession !== undefined) {270 proactiveServiceRequest.configMediaProtectionManager(that.mediaPlayer.mediaProtectionManager);271 }272 that.setSource();273 that.proactiveServiceRequest = proactiveServiceRequest;274 }, f_bFirstPlayExpiration);275 });276 }277 },278 setMediaPlayer: function () {279 this.mediaPlayer = new MediaPlayer(this.videoIndex);280 this.mediaPlayer.setupVideoPlayer();281 },...

Full Screen

Full Screen

temperatureDisplay.js

Source:temperatureDisplay.js Github

copy

Full Screen

1import React, { Component } from 'react';2import { Buffer } from 'buffer';3import {4 Text,5 View,6 StyleSheet,7 Vibration8} from 'react-native';9class TemperatureDisplay extends Component {10 constructor(props) {11 super(props);12 this.state = {13 temperature: "Na"14 };15 this.pollForData = this.pollForData.bind(this);16 }17 componentDidMount() {18 this.pollForData();19 }20 pollForData() {21 const device = this.state.connected;22 this.props.device.monitorCharacteristicForService(this.props.serviceId, this.props.serviceId, (error, characteristic) => {23 this.setState({24 temperature: TemperatureDisplay.readFloat(characteristic.value)25 });26 });27 }28 static readFloat(b64EncodedValue) {29 return new Buffer(b64EncodedValue, "base64").readFloatLE(0).toFixed(2);30 }31 render() {32 return (33 <View style={styles.container}>34 <Text style={styles.info}>{this.state.temperature}</Text>35 </View>36 )37 }38}39const styles = StyleSheet.create({40 container: {},41 info: {42 fontSize: 30,43 padding: 40,44 color: 'white'45 }46});...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var apickli = require('apickli');2var apickliObject = new apickli.Apickli('http', 'localhost:8000');3apickliObject.b64EncodedValue('username:password');4var apickli = require('apickli');5var apickliObject = new apickli.Apickli('http', 'localhost:8000');6apickliObject.b64DecodedValue('dXNlcm5hbWU6cGFzc3dvcmQ=');7var apickli = require('apickli');8var apickliObject = new apickli.Apickli('http', 'localhost:8000');9apickliObject.setVariable('myVariable', 'someValue');10var apickli = require('apickli');11var apickliObject = new apickli.Apickli('http', 'localhost:8000');12apickliObject.setVariable('myVariable', 'someValue');13apickliObject.getVariable('myVariable');14var apickli = require('apickli');15var apickliObject = new apickli.Apickli('http', 'localhost:8000');16apickliObject.setRequestHeader('Content-Type', 'application/json');17var apickli = require('apickli');18var apickliObject = new apickli.Apickli('http', '

Full Screen

Using AI Code Generation

copy

Full Screen

1var apickli = require('apickli');2var b64 = new apickli.Apickli();3b64.b64EncodedValue('test', 'test');4console.log(b64.b64EncodedValue('test', 'test'));5var apickli = require('apickli');6var b64 = new apickli.Apickli();7b64.b64EncodedValue('test', 'test');8console.log(b64.b64EncodedValue('test', 'test'));

Full Screen

Using AI Code Generation

copy

Full Screen

1var apickli = require('apickli');2var b64 = new apickli.Apickli('https', 'api.enterprise.apigee.com');3var encodedStr = b64.b64EncodeUnicode('username:password');4console.log(encodedStr);5var apickli = require('apickli');6var b64 = new apickli.Apickli('https', 'api.enterprise.apigee.com');7var decodedStr = b64.b64DecodeUnicode('dXNlcm5hbWU6cGFzc3dvcmQ=');8console.log(decodedStr);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run apickli automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful