I created a sample application using samsung tv sdk and added video player with the bellow code.but it does not playing my video
SceneScene1.prototype.initialize = function () {
alert("SceneScene1.initialize()");
// this function will be called only once when the scene manager show this scene first time
// initialize the scene controls and styles, and initialize your variables here
// scene HTML and CSS will be loaded before this function is called
sf.service.VideoPlayer.init({
onend:function(){
sf.service.VideoPlayer.setFullScreen(false);
}
});
sf.service.VideoPlayer.setKeyHandler(sf.key.RETURN,
function(){
sf.service.VideoPlayer.setFullScreen(false);
});
var vLeft = parseInt($("#svecVideo_y5ww").css('left'));
var vTop = parseInt($("#svecVideo_y5ww").css('top'));
var vHeight = parseInt($("#svecVideo_y5ww").css('height'));
var vWidth = parseInt($("#svecVideo_y5ww").css('width'));
sf.service.VideoPlayer.setPosition({
left:vLeft,
top:vTop,
width:vWidth,
height:vHeight
});
sf.service.VideoPlayer.show();
sf.service.VideoPlayer.play({
url: 'http://media.w3.org/2010/05/sintel/trailer.mp4',
fullScreen: false,
title: 'Samsung movie',
startTime: 5,
liveStream: false,
timeString: true,
authHeader: 'none'
});
};
and if we try to inspect using web inspector.it shows the bellow errors
Service is unavailable due to network or service interference.
The file can't be played because the format isn't supported.
Unable to play the file. Please check it and try again later.
i tried with different files,and shows the same error
Related
Due to the environment I have to implement my code into, I can't use 'import'. I'm able to get the library I need just fine but I'm running into the following error when trying to use it.
"jQuery.Deferred exception: videojs is not defined ReferenceError: videojs is not defined"
I've found workarounds for videoJS that require using something like the following
import videojs from 'video.js';
window.videojs = videojs;
require('videojs-http-source-selector');
Unfortunately that won't work since import is out of the question. Is there a way to work around this?
Below is my code in question. I use the ScriptLoader to load the library by file path in my solution.
/*This JS is meant to create an HMTL video component, then stream JSVideo/HLS to it. It's integrated in a no-code/low-code solution and is very particular about structure.*/
function MyControl() { };
MyControl.prototype.initialize = function(host, component){
/*Here we load our libraries. We must load it this way because of the way we integrate javascript into the no code solution*/
$.when(
$DP.ScriptLoader.LoadScript(
virtualPath + "/scripts/FormControls/jsFiles/video.js"
)
)
// Here we assign 'host' to a variable on this control,
// so that we can access it later:
this.host = host;
// Create and configure the video elemnt:
var video = document.createElement('video-js');
video.setAttribute("id","videoplayer");
video.setAttribute("class","video-js vjs-default-skin");
// Add the video to the 'host' jquery object:
host.append(video);
//Gets the source and plays on our video element previosuly made.
const player = videojs('videoplayer', {
html5: {
hls: {
withCredentials: true
}
},
controls : true,
fluid: true,
controlBar: {
children: ['playToggle', 'volumePanel', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'seekToLive', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subsCapsButton', 'audioTrackButton', 'settingMenuButton', 'qualitySelector','fullscreenToggle']
},
preload : 'auto',
poster : '',
});
player.src({
src: 'http://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.m3u8',
type: 'application/x-mpegURL'
});
player.play();
};
MyControl.prototype.resize = function(height, width) {
if (this.host && height && width && (height > 0) && (width > 0)) {
this.host.css({ width: width, height: height });
}
};
MyControl.prototype.setValue = function(data){
// This control has no inputs, so no code is necessary here.
};
MyControl.prototype.getValue = function() {
// Output data should be an object with properties that match the
return {
};
};
how about
var videojs = require(/path/+'video.js');
i write a code for scan passport id .. i have plustek reader (x50). i can capture image from my device in javascript (webcam.js).. but when capture image the light source not run . how can run the led light before capture image ... i need cod in javascript becouse the device in client side .. my application not mobile apps.. it web application .
// Configure a few settings and attach camera
function configure() {
Webcam.set({
width: 320,
height: 240,
image_format: 'jpeg',
jpeg_quality: 90,
flip_horiz: true,
});
Webcam.attach('#my_camera');
}
// A button for taking snaps
// preload shutter audio clip
var shutter = new Audio();
//shutter.autoplay = true;
shutter.src = navigator.userAgent.match(/Firefox/) ? 'shutter.ogg' : 'shutter.mp3';
function take_snapshot() {
// play sound effect
shutter.play();
// take snapshot and get image data
Webcam.snap(function (data_uri) {
// display results in page
document.getElementById('results').innerHTML =
'<img id="imageprev" src="' + data_uri + '"/>';
////////////
////////////////
var base64image = document.getElementById("imageprev").src;
var strImage = base64image.replace(/^data:image\/[a-z]+;base64,/, "");
//
// $("#<%=Image1.ClientID%>")
// .attr("src", base64image)
});
Webcam.reset();
}
I am tryint to use howler.js to play a chain of sounds in a phonegap app. In the mobile browser or even the normal browser this code works fine! but when i compile to an apk or i use phonegap build.. i can not get any sound from howler.js :(
the following code is very basic, it is just for one sound clip but my issue is the same...
function load_sound_test() {
// just for set the clip
var namesoundtest = "sounds/effects/" + document.getElementById('xsoundtest').value + ".webm";
var newnamesound = array_sound_test.push(namesoundtest);
var namesoundtest = "sounds/effects/" + document.getElementById('xsoundtest').value + ".mp3";
var newnamesound = array_sound_test.push(namesoundtest);
var namesoundtest = "sounds/effects/" + document.getElementById('xsoundtest').value + ".wav";
var newnamesound = array_sound_test.push(namesoundtest);
sound_test = new Howl({
src: array_sound_test,
preload: true,
autoplay: false,
loop: false,
buffer: true
});
console.log("sound test loaded");
}
function play_sound_test() {
// just to play the clip
sound_test.play()
console.log("sound test played");
}
I have an electron app that runs in the menubar.
Code is currently heavily based on an existing pomodoro app (https://github.com/G07cha/pomodoro)
When the timer hits a certain point, it opens up a message box:
ipc.on('end-timer', function() {
$('.timer').circleProgress('value', 1);
var isRelaxTime = remote.getGlobal('isRelaxTime');
dialog.showMessageBox({
type: 'info',
title: 'Pomodoro',
message: (isRelaxTime) ? 'Timer ended it\'s time to relax' : 'Back to work',
buttons: ['OK'],
noLink: true
}, function() {
if(isRelaxTime) {
$('.timer').circleProgress({fill: { gradient: ["blue", "skyblue"]}});
} else {
$('#counter').text(remote.getGlobal('pomodoroCount'));
$('.timer').circleProgress({fill: { gradient: ["orange", "yellow"]}});
}
ipc.send('start-timer');
});
});
Is it possible to open a new window instead of the message box, and make it full screen?
Basically, making sure the user sees it and it fills the screen when the timer is up and allowing customization of the page that comes up with css and such.
It depends if you want to fire a new renderer from an existing renderer or if you want to spin it up from the Main Process.
Either way its as easy as creating a new BrowserWindow instance and loading a URL to an HTMl file you want to load.
If you want to spin up a renderer from an existing renderer you will need to require the remote module first. Here is an example:
const remote = require('remote');
// create a new BrowserWindow and pass it an object of options
var msgWindow = new remote.BrowserWindow({
// full width & height of monitor without going into kiosk mode
width: remote.screen.getPrimaryDisplay().size.width,
height: remote.screen.getPrimaryDisplay().size.height
//, other options
});
// load your message file into new browserwindow
msgWindow.loadURL('file://' + __dirname + '/index.html');
// set variable to null when window is closed to clean it up
msgWindow.on('close', () => {
msgWindow = null;
});
If you did this from the the Main Process, then replace const remote = require('remote'); with:
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
I have recently been learning about Firefox OS/B2G. I am aware of the extensive set of APIs in place that are able to fetch images from the wallpaper gallery, change settings and set reminders (to name a few). However, I'm completely stumped as to how to how to change the wallpaper, or, indeed, if this is even possible. Apologies if this is a silly question. Many thanks in advance.
You can do this by using a share activity
// imgToShare is the image you want to set as wallpaper
var shareImage = document.querySelector("#share-image"),
imgToShare = document.querySelector("#image-to-share");
if (shareImage && imgToShare) {
shareImage.onclick = function () {
if(imgToShare.naturalWidth > 0) {
// Create dummy canvas
var blobCanvas = document.createElement("canvas");
blobCanvas.width = imgToShare.width;
blobCanvas.height = imgToShare.height;
// Get context and draw image
var blobCanvasContext = blobCanvas.getContext("2d");
blobCanvasContext.drawImage(imgToShare, 0, 0);
// Export to blob and share through a Web Activitiy
blobCanvas.toBlob(function (blob) {
new MozActivity({
name: "share",
data: {
type: "image/*",
number: 1,
blobs: [blob]
}
});
});
}
else {
alert("Image failed to load, can't be shared");
}
};
}
You can test a live example with the Firefox OS boilerplate https://github.com/robnyman/Firefox-OS-Boilerplate-App/ .