How to play video in node-webkit? - node-webkit

I am facing problem while playing video in Node-Webkit. Below is a small piece of code which is easily playable in Google Chrome, Firefox Browser but the not playable in node webkit. For this, I created an index.html file as:-
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<video width="320" height="240" autoplay loop>
<source src="https://doc-0o-1o-docs.googleusercontent.com/docs/securesc/jt8pk7gigobp59vrjgh53u3p8g7qenum/o37l8tolk3h4csn224kvl48gu9se31l1/1445882400000/11930958689028763066/11930958689028763066/0Bz1uVMPq87g1RXBiZGhGLUU2N00?e=download&nonce=8bb1u4fusajn4&user=11930958689028763066&hash=dtoaurvnsob2c2avkthk3ss1ierjm7iv" type="video/mp4">
</video>
</body>
</html>
The index.html is easily runnable in any browser. The src video here I uploaded is an MP4 video which I have uploaded to my google drive. You can download one through the following link:-
demo.mp4
And to run this file in node-webkit, my package.json is as follows:-
{
"name": "Demo Project",
"version": "0.0.1",
"description": "Demo Project",
"main": "index.html",
"private": true,
"keywords": [
"node",
"webkit",
"win",
"osx"
],
"window": {
"toolbar": true,
"resizable": true,
"width": 1400,
"height": 750,
"position": "center",
"kiosk": false
},
"author": "Kamaldeep Singh",
"license": "MIT"
}
Can anyone help me how to play a custom mp4 video in node-webkit HTML pages ?
Note: I am using angularjs in my project and have also tried ngVideo plugin.
Other suggestions are also welcome.

Related

can't find external reference within capacitor

I'm starting with es6 and capacitorjs.
I need to build a google auth for an app.
I followed this instructions here https://github.com/CodetrixStudio/CapacitorGoogleAuth.
Tried too many different things, looks like there is an issue about not serving the node_modules folder in my webserver, but I really can't figure out what is wrong.
I'm attaching an image which represents my directory structure:
The index.js file is declared in index.html file like this:
<html>
<head>
<meta name="google-signin-client_id" content="{your client id here}">
</head>
<body>
<h1>my title</h1>
</body>
<script src="capacitor.js"></script>
<script src="index.js" type="module"></script>
<script >
//this is working properly, but capacitor.js is declared here
console.log('element is loaded...')
Capacitor.Plugins.Storage.set({key:'test', value:'val'});
Capacitor.Plugins.Storage.get({ key: 'test' }).then(function(result) {
document.querySelector('h1').innerText = 'chave:' + result.value;
});
</script>
</html>
the index.js file goes below:
import "../#codetrix-studio/capacitor-google-auth";
import { Plugins } from '../#capacitor/core';
Plugins.GoogleAuth.signIn();
My console output:
My package.json file:
{
"name": "myapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"#capacitor/android": "^2.4.6",
"#capacitor/cli": "^2.4.6",
"#capacitor/core": "^2.4.6",
"#codetrix-studio/capacitor-google-auth": "^2.1.3",
"serve": "^11.3.2"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "yarn serve www"
},
"author": "",
"license": "ISC"
}
Found it.
Just needed to add a code transpiler.
In my case, i added parceljs.
yarn global add parcel-bundler
Later, i made a new folder to keep my source code.
mkdir frontend
Finally, added a new script called watch in my package.json file
"scripts": {
"watch": "parcel watch frontend/*.html --out-dir www"
}

Vue App Blank page in IE-11 and Ms Edge 40

I was given a Vue app that is working perfectly in Chrome, Firefox.
But blank page in IE-11 and Ms Edge. No Erorrs in console.
I'm not a Vue developer but I'm interested in Vue. So Tried to find a solution googling it. But no of those solutions works for me. Can someone please tell me what should I do to fix this blank page issue in IE-11 & Edge?.
main.js
import 'babel-polyfill'
import Vue from 'vue'
import Request from './http/request'
const EXCLUDED_PROD = [
'52.59.217.237',
'localhost'
]
babel.config.js
module.exports = {
presets: [
['#vue/app', {
polyfills: [
'es6.promise',
'es6.symbol'
]
}]
]
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>fav.png">
<title>Starline Security</title>
</head>
<body>
<noscript>
<strong>We're sorry but Starline Security doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!--built files will be auto injected-->
</body>
</html>
package.json
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
How do you create your vue project? I create vue project according to this link and choose default. It can run well in IE and Edge without installing other packages.
I compared the files in the working project with yours and the babel.config.js and package.json are different. You could try to edit your babel.config.js and package.json according to below.
babel.config.js:
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
]
}
package.json:
{
"name": "hello-world",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"#vue/cli-plugin-babel": "^4.4.0",
"#vue/cli-plugin-eslint": "^4.4.0",
"#vue/cli-service": "^4.4.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Besides, it seems that your main.js is not complete. Mine is like this:
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')

The problem of adding the code to the program

I want to addg ckeditor 4.11.4 in my ASP.NET Core MVC project with bundle.
I use ASP.NET Core 2.2 and the bootstrap bundling is working.
This is my package.json :
{
"version": "1.0.0",
"name": "asp.net",
"private": true,
"devDependencies": { },
"dependencies": {
"bootstrap": "4.3.1",
"font-awesome": "4.7.0",
"jquery": "3.4.1",
"popper.js": "2.0.0-next.4",
"ckeditor": "4.11.4"
}
}
And this is my bundleconfig.json file:
[
{
"outputFileName": "wwwroot/vendor.min.css",
"inputFiles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/ckeditor/contents.css"
],
"minify": { "enabled": false }
},
{
"outputFileName": "wwwroot/vendor.min.js",
"inputFiles": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/popper.js/dist/umd/popper.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/ckeditor/ckeditor.js"
],
"minify": { "enabled": false }
}
]
But this does not work. What's the problem?
Font-awesome css references use sprites and webfonts folders !
Copy font-awesome folder to wwwroot/lib folder.
and use in head
<link rel="stylesheet" href="~/lib/font-awesome/css/fontawesome.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/regular.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/solid.min.css" />

Debugger settings for Chrome in VS Code with Vue.js

With the following settings in .vscode\launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
I can set a breakpoint in index.js file in my project and it triggers successfully, but the breakpoints in *.vue files triggers incorrectly.
With the following settings:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}
]
}
vice versa, the breakpoints in *.vue files are triggered successfully, but I cannot set a breakpoint in my index.js file.
How to make the breakpoints work in both *.js and *.vue?
See more detailed information on how I set up the environment.
I was very surprised, but adding two versions of the source map override worked for me. I can now set and have it stop on breakpoints in .vue files, .js files, and my imported es6 modules. It only took me about a month to find a solution!
Hope it works for you (this doesn't work for me anymore. See below)
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*",
"webpack:///src/*": "${webRoot}/*"
}
Updated October 2019:
Debugging both js and vue files had broken for me in a recent update. I have finally found new settings that work for both:
"sourceMapPathOverrides": {
"webpack:///src/*.vue": "${webRoot}/*.vue",
"webpack:///./src/*.js": "${webRoot}/*.js"
}
And here is what is working for me in September of 2020 in vsCode 1.49.1: very similar to Steve's answer above:
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/src/*",
"webpack:///./src/*.js": "${webRoot}/src/*.js",
}

Videojs playlist not work

i have a problem when i try use the playlist plugin of video js like that example:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Playlist Tester Perform</title>
<style type="text/css">
.video-js {
float: left;
margin: 15px;
width: 440px;
height: 280px;
}
.vjs-playlist {
width: 250px;
float: left;
margin: 15px;
}
</style>
</head>
<body>
<video id="myPlayerID"
data-account="3676484087001"
data-player="04ac0699-ca6b-449b-a2b6-0f14b4a7893b"
data-embed="default"
class="video-js" controls></video>
<ol class="vjs-playlist"></ol>
<script src="//players.brightcove.net/3676484087001/04ac0699-ca6b-449b-a2b6-0f14b4a7893b_default/index.min.js"></script>
<script type="text/javascript">
videojs('myPlayerID').ready(function () {
var myPlayer = this;
myPlayer.playlist([{
"sources": [{
"src": "http://solutions.brightcove.com/bcls/assets/videos/Sea_SeaHorse.mp4", "type": "video/mp4"
}],
"name": "Seahorse",
"thumbnail": "http://solutions.brightcove.com/bcls/assets/images/Sea_Seahorse_poster.png",
"poster": "http://solutions.brightcove.com/bcls/assets/images/Sea_Seahorse_poster.png"
}, {
"sources": [{
"src": "http://solutions.brightcove.com/bcls/assets/videos/Sea_Anemone.mp4", "type": "video/mp4"
}],
"name": "Sea Anemone",
"thumbnail": "http://solutions.brightcove.com/bcls/assets/images/Sea_Anemone_poster.png",
"poster": "http://solutions.brightcove.com/bcls/assets/images/Sea_Anemone_poster.png"
}, {
"sources": [{
"src": "http://solutions.brightcove.com/bcls/assets/videos/Tiger.mp4", "type": "video/mp4"
}],
"name": "Tiger",
"thumbnail": "http://solutions.brightcove.com/bcls/assets/images/Tiger_poster.png",
"poster": "http://solutions.brightcove.com/bcls/assets/images/Tiger_poster.png"
}, {
"sources": [{
"src": "http://solutions.brightcove.com/bcls/assets/videos/Sea_ClownFish.mp4", "type": "video/mp4"
}],
"name": "Clownfish",
"thumbnail": "http://solutions.brightcove.com/bcls/assets/images/Sea_ClownFish_poster.png",
"poster": "http://solutions.brightcove.com/bcls/assets/images/Sea_ClownFish_poster.png"
}, {
"sources": [{
"src": "http://solutions.brightcove.com/bcls/assets/videos/Sea_LionFish.mp4", "type": "video/mp4"
}],
"name": "Lionfish",
"thumbnail": "http://solutions.brightcove.com/bcls/assets/images/Sea_LionFish_poster.png",
"poster": "http://solutions.brightcove.com/bcls/assets/images/Sea_LionFish_poster.png"
}]);
});
</script>
</body>
</html>
When i change the videos links to my local folder ("src": "/files/convert/videos/38472531Test.mp4", "type": "video/mp4"), the playlist doesn't advance to the next video. I think it is a problem of ffmpeg conversion but i'm not sure of that.
PD:The problem is only in the playlist not in the playing
i have just been having this same issue. I worked out on mine that if i set the url for the video file to http://myip/path to video file instead of giving it a local link to the file mine starts to auto play. Is this the case on yours?
I assume that this is a bug in the playlist plugin but it seems to work as a workaround in my case.