ReactJS and JWPlayer - javascript

please I am looking for a way to use JW Player with ReactJS.
I have implemented it in the best form i could think possible but i keep getting an error that says jwplayer is not a function.
My Implementation
var jwplayer = require('../../../assets/plugins/jwplayer-7.6.1/jwplayer.js');
loadPlayer(){
var {ui} = this.props;
var {camera} = ui;
jwplayer(this.state.playerEl).setup({
sources: [{
file: camera.src,
}],
streamer: camera.streamname,
provider: 'rtmp',
aspectRation: '16:9',
width: '100%',
rtmp: {
bufferlength: 3
},
});
}
The loadPlayer() function is actually in a component where I call it from the componentDidMount()method.
Thanks in advance.

Related

It is possible to use javascript to import ads on unity in a way similar to Html?

I would know if it is possible to import banner ads on a unity 2D game inside an UI object using the code that the provider sent to me. I post it below:
<div id="div_id"></div>
<script type="application/javascript">
var sas = sas || {};
sas.cmd = sas.cmd || [];
sas.cmd.push(
function () {
sas.call(
{ siteId: ######, pageId: ######, formatId: ######, tagId: "div_id" },
{ networkId: ####, domain: "//www.#provider#.com" /*, onNoad: function() {} */ }
);
}
);
</script>
Thanks in advance!
I think this unity asset may help you:
Embedded Browser
In general, there is no easy way to achieve it unless you use the plugin.

How to do Framework7 routing with jQuery?

I am developing a hybrid mobile app with Framework7. I finished the user interface successfully and now I want to add functionality to my app. My problem is the navigation from one .html to another.
At the user interface i did the navigation with links, like this:
LOGIN
Because of some checks I removed the whole href-tag and here I come to the problem, how can i do this linking in jQuery?
I tried a lot, also followed the public "Router JavaScript API" (https://v1.framework7.io/docs/router-api.html) but nothing worked well (NOTE: this is not my whole code, just the affected parts):
Attempt 1
var myApp = new Framework7 ({});
var mainView = myApp.views.add('.view-main');
var app = {
init: function () {
events.doClickFunctions();
},
login: {
success: function () {
//here should be the linking done
mainView.router.load('/homepage/');
}
}
};
Problem: "myApp.views.add is not a function"
Attempt 2
var myApp = new Framework7 ({});
var mainView = myApp.addView('.view-main');
var app = {
init: function () {
events.doClickFunctions();
},
login: {
success: function () {
//here should be the linking done
mainView.router.load('/homepage/');
}
}
};
Problem: "myApp.addView is not a function"
And i tried some other combinations, but nothing worked.
Furthermore, I made a workaround: If the checks are successful, the href attribute will be added with jQuery and a virtual click is made on the element. So the user experience is like i want it to, but I guess thats not how it is supposed to work?
Thank you in advance!
try this
var app = new Framework7({
id: 'io.framework7.testapp',
precompileTemplates: true, //
template7Pages: true,
root: '#app',
theme: theme,
cache: false ,/* disable caching */
data: function () {
},
methods: {
helloWorld: function () {
app.dialog.alert('Hello World!');
},
},
routes: routes,
vi: {
placementId: 'pltd4o7ibb9rc653x14',
}
});
app.views.main.router.navigate('/login/');
for routing to another Page in jq use this :
app.views.main.router.navigate('/login/');

SapUI5 getting "Uncaught ReferenceError: page1 is not defined"

I saw similar questions but none of them did not solved mine.
Here is my page creation code in html.
<script>
sap.ui.localResources("empcrud");
sap.ui.getCore().attachInit(function() {
var app = new sap.m.App("myApp");
var page = new sap.m.Page({
title: "Bar",
enableScrolling: true,
content: [new sap.ui.core.ComponentContainer({
height: "100%", name: "sap.viz.sample.Bar"
})]
})
var page1 = sap.ui.view({initialPage:"idEmpDetails1",viewName: "empcrud.EmpDetails", type: sap.ui.core.mvc.ViewType.JS });
app.addPage(page1).addPage(page);
app.to(page1);
app.placeAt("content");
});
</script>
and its my next page function in controller
NextPage: function () {
sap.ui.getCore().byId("myApp").to(page1);
},
I tought sap.ui.getCore returns NULL, but cant find it anyway.
I can see that you have not given any ID to your app control. So change the second line like this,
var app = new sap.m.App("myApp",{initialPage:"idEmpDetails1"});
and then try to navigate. Also in the page1 you have not given your view name, so provide view id, name, type like page.
Hope this helps!!

Ionic Cordova can not share video on social sites

I am trying to use the cordova social sharing plugin for sharing video on social sites. So far what I have achieved is, I have successfully captured video using following code -
var options = {
limit: 1,
duration: 15
};
$cordovaCapture.captureVideo(options).then(function (videoData) {
$scope.videoUrl = videoData[0].fullPath;
}, function (err) {
// An error occurred. Show a message to the user
//alert("video error : "+err);
});
I can successfully find the captured video files url but unfortunately I can not share them to the social media sites. I have tried both of the following methods -
$cordovaSocialSharing
.share(message, subject, file, link)
and
$cordovaSocialSharing
.shareViaTwitter(message, image, link)
Now my question is -
Is there any way to share video through this approach?
If not, please let me know if there is any possible way for this.
N.B. : I have already bothered the Google a lot.
Thanks in advance.
my problem was passing a bad filePath, so i found a solution like below :
import {CaptureError, MediaFile, MediaCapture, CaptureImageOptions, Transfer} from "ionic-native";`
declare let cordova: any;
private static options = {
message: '', // not supported on some apps (Facebook, Instagram)
subject: '', // for email
files: [''], // an array of filenames either locally or remotely
url: ''
};
videoOptions: CaptureImageOptions = {limit: 1};
videoData: any;
captureVideo() {
MediaCapture.captureVideo(this.videoOptions)
.then(
(data: MediaFile[]) => {
this.videoData = data[0];
const fileTransfer = new Transfer();
fileTransfer.download(this.videoData.fullPath, cordova.file.applicationStorageDirectory + 'fileDir/filename.mp4').then((entry) => {
this.options.message = " Your message";
this.options.subject = "Your Subject";
this.options.files = [entry.toURL()];
this.options.url = "https://www.google.com.tr/";
SocialSharing.shareWithOptions(this.options);
}, (error) => {
});
},
(err: CaptureError) => {
}
);
}
As you see above, i just copy my video file to applicationStorageDirectory

swfobject.embedSWF not working in iOS

I'm learning how YouTube player works with Javascript. I have this code because I want to make a video gallery and it works perfectly in any browser (the idea is to switch between videos by the ID), the problem is when I try to test in on my ipad it doesn't display anything. Any suggestions for iOS?
Thanks in advance!
swfobject.embedSWF("http://www.youtube.com/v/3sL8aaMw7ZQ?enablejsapi=1&rel=0&fs=1",
"ytplayer-temp",
"400",
"226",
"10.1",
false,
false,
{ allowScriptAccess: "always", allowFullScreen: "true" },
{ id: "ytplayer" }
);
function ytplayer_loadvideo(id) {
var o = document.getElementById("ytplayer");
if (o) {
o.loadVideoById(id);
}
}
No flash support for iOS. You have to use html5 instead.
https://developers.google.com/youtube/getting_started

Categories