Orientation Lock

Hello ,
How can I lock screen orientation to landscape mode when game starts.
Below code I used but it seems not working fine.

var MobileView = pc.createScript('mobileView');

MobileView.prototype.initialize = function () {
    if (pc.platform.mobile) {
        console.log("Mobile device");
        if (screen.orientation.lock('landscape-primary')) {
            console.log("Orientation locked to landscape");
        } else {
            console.log("Orientation lock failed.");

thank you

Which browser are you using to test this? According to the MDN Web Docs ScreenOrientation: lock() is very poorly supported. Safari and Firefox for Android have no support and many other browsers only partially support it.