Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Filter
Develop Samsung IAP
websamsung in-app purchase seamless integration with galaxy store for your in-app purchase products what is samsung in-app purchase? samsung in-app purchase (iap) is a payment service that makes it possible to sell a variety of products in applications for samsung galaxy store and internally manages communication with supporting iap services in the samsung ecosystem, such as samsung account, samsung checkout, and samsung rewards. learn more four basic steps to selling in-app products start selling in-app products by integrating with samsung iap. 1. develop your app using our sdk download the samsung in-app purchase sdk and integrate it into your app. 2. request commercial seller status you must be a commercial seller in order to sell your in-app products. 3. register your app upload your binary file to samsung galaxy store seller portal. 4. add in-app products to your app add in-app products and register product-related information. technical documents programming guide how to integrate and configure iap, the iap sdk and iap server apis, and what to do before submitting your app to galaxy store. subscription guide how to manage subscriptions and an explanation of the pricing options configured in samsung galaxy store seller portal. test guide how to test in-app product purchase and payment. iap api guides how to view, register, modify, and remove samsung iap products and view all payments and refunds on a specific date. sdk and plugins sdk samsung iap libraries and sample app. unity plugin samsung iap-related scripts and libraries used to integrate with the unity engine. unreal plugin samsung iap-related scripts and libraries used to integrate with the unreal engine. videos samsung developers youtube nov 6, 2019 maximize your revenue with samsung in-app purchase learn about the new features and improvements released in samsung iap 6.0. review the steps to register your app in seller portal, test samsung iap integration, and how to publish your app in galaxy store. nov 6, 2019 nov 11, 2018 monetize your games with samsung in-app purchase introduction to samsung iap plug-in functionality for unity and unreal game engines. learn how to integrate, register and publish your game with samsung iap. nov 11, 2018 have questions? samsung answers your frequently asked questions and provides a forum to communicate with other developers. faq forum
Distribute Samsung IAP for Galaxy Watch (Tizen)
docweb iap for galaxy watch samsung in-app purchase iap for galaxy watch is a galaxy store service that allows third-party watch applications to sell in-app items iap for galaxy watch only works if your galaxy watch is paired with your phone the iap client for watch communicates with the iap client for phone which internally manages communication with supporting iap services and the samsung ecosystem such as samsung account, samsung checkout, and samsung rewards in other words, it acts as an intermediary between watch app and samsung iap system of the phone you can concentrate on integrating iap api calls and iap server api calls into your watch app to integrate iap for galaxy watch using tizen extension sdk, iap web apis enable you to easily integrate iap functionality into your watch app, such as configuring iap, getting item details, offering and selling items, and managing purchased items using galaxy watch studio formerly galaxy watch designer , you can make your own watch face that prompts for payment after a free trial period, without the complexity of coding for more details, see the galaxy watch studio online tutorial by integrating iap features, your watch apps can sell these types of in-app items item type description consumable app users can use items only one time for example, coins, special powers, or gems non-consumable app users can use items any number of times for example, e-books or game boards items cannot be repurchased note during iap integration testing, if your application sets to test mode, the purchase record is initialized every 60 minutes to allow repurchase auto-recurring subscription these items are purchased automatically at specific intervals app users can access items such as magazines, e-zines, or newspapers any number of times during a free trial or while their paid subscriptions are active app users can cancel at any time after purchase during subscription period app users can repurchase items after cancellation note during iap integration testing, if your application is set to test mode, the subscription cycle is automatically renewed every 10 minutes and the subscription is automatically canceled after 12 renewals integrate iap into your watch app this section explains how to prepare your app to sell in-app items using tizen extension sdk you can use galaxy watch studio to make a watch face that prompts for payment after a free trial period, without the complexity of coding to prepare for integrating iap features and testing the integration, do the following 1 create a project create a project in tizen studio the required_version must be at least 2 3 2 in the config xml file <?xml version="1 0" encoding="utf-8"?> <widget xmlns tizen="http //tizen org/ns/widgets" xmlns="http //www w3 org/ns/widgets" id="http //yourdomain/webiap" version="1 0 6" viewmodes="maximized"> <tizen application id="wxwmxrcelo webiap" package="wxwmxrcelo" required_version="4 0 0"/> </widget> 2 add permissions to config xml <tizen privilege name="http //tizen org/privilege/billing"/> 3 register an app and in-app items in seller portal during iap integration, you may need to test iap features samsung iap needs information about your app and in-app items registered in seller portal note your app does not need to have iap features integrated in order to register the app and its in-app items as iap integration proceeds, you can upload new versions of your app and new in-app items as needed to register an app and its in-app items sign in to seller portal https //seller samsungapps com using your samsung account click add new application click galaxy watch, select the default language, and click next in the binary tab, upload your app tpk in the app information tab, enter fundamental app details in the country / region & price tab, specify a free or paid app, a paid app price, and countries to sell your items in the in app purchase tab, register one or more in-app items caution don't click *submit beta test * or *submit * in this step for more app registration details, see the app registration guide for more in-app item registration details, see the item registration guide 4 integrate iap features get in-app items available for purhcase purchase an in-app item get a list of purchased items operation mode iap supports three operational modes one is for enabling billing for item purchases and the other two are for testing iap functions without billing app users for item purchases mode description iap_commercial_mode financial transactions do occur for successful requests, and actual results are returned successful or failed the app gets in-app item information of the app whose status in seller portal is for sale iap_success_test_mode financial transactions do not occur app users are not billed for item purchases , and successful results are always returned the app gets in-app item information of the app whose status in seller portal is registering or updating iap_failure_test_mode all iap requests fail negative testing to ensure that your app can handle errors such as improper input and user actions note the tizen emulator only supports these two modes iap_success_test_mode iap_failure_test_mode if you set the mode to iap_commercial_mode, it is automatically changed to iap_success_test_mode get in-app items available for purchase to get all registered in-app items from galaxy store, use the getitemlist method pass in the index of the first and last item, the item type, service mode, callback function, and user data as parameters when the reply is delivered, the getitemsuccesscallback or errorcallback callback is invoked with the jsonobject that stores the query results request for details, see the getitemlist void getitemlist long startnumber, long endnumber, itemtype type, iapmode mode, getitemsuccesscallback successcallback, optional errorcallback? errorcallback ; response [callback=functiononly, nointerfaceobject] interface getitemsuccesscallback { void onsuccess jsonobject result ; }; [callback=functiononly, nointerfaceobject] interface errorcallback { void onerror webapierror error ; }; common result key value type description merrorcode int error code number merrorstring string error message _items array item list item details key value type description mitemid string item id numberthis is the same as the item id used in the request mitemname string name provided during the item registration in the seller portal mitemprice string item price in a local currency mitempricestring string currency code + pricefor example €7 99 mcurrencyunit string device user currency unit for example $, won, or pound mcurrencycode string currency codefor example eur or gbp mitemdesc string item description provided during the item registration mitemimageurl string item image url provided during the item registration mitemdownloadurl string item download url provided during the item registration mtype string item type 00 consumable01 non-consumable02 non-recurring subscription03 auto-recurring subscription 10 all msubscriptiondurationunit string subscription duration unit, defined as an upper case string month msubscriptiondurationmultiplier string if the item type mtype is 02 or 03, this is the item duration combined with msubscriptiondurationunit, it expresses the subscription duration, for example, 1month code snippet request the available items, and retrieve the item details in the reply callback webapis inapppurchase getitemlist 1, 15, "consumable", "iap_commercial_mode",successcallback, errorcallback ; /* success callback */ function successcallback result { if result _items length == 0 { console log "no item" ; } else { for var i = 0; i < result _items length; i++ { console log "item id " + result _items[i] mitemid ; console log "item name " + result _items[i] mitemname ; console log "item price " + result _items[i] mitemprice ; } } } /* error callback */ function errorcallback error { /* error handling */ } purchase an in-app item to purchase items from galaxy store, use the startpayment method pass in the index of the item id, service mode, callback function, and user data as parameters when the reply is delivered, the paymentsuccesscallback or errorcallback callback is invoked with the jsonobject that stores the query results request for details, see the startpayment void startpayment domstring itemid, iapmode mode, paymentsuccesscallback successcallback, optional errorcallback? errorcallback ; response [callback=functiononly, nointerfaceobject] interface paymentsuccesscallback { void onsuccess jsonobject item ; }; [callback=functiononly, nointerfaceobject] interface errorcallback { void onerror webapierror error ; }; common result key value type description merrorcode int error code number merrorstring string error message purchased item details key value type description mitemid string item id numberthis is the same as the item id used in the request mitemname string name provided during the item registration in the seller office mitemprice double item price in a local currency mitempricestring string currency code + pricefor example €7 99 mcurrencyunit string device user currency unitfor example $, won, or pound mcurrencycode string currency codefor example eur or gbp mitemdesc string item description provided during the item registration mitemimageurl string item image url provided during the item registration mitemdownloadurl string item download url provided during the item registration mpaymentid string id of the payment mpurchaseid string purchase ticket id used to verify the purchase with the store iap server mpurchasedate string date of purchasefor example "2013-11-15 10 31 23" mverifyurl string server's url, which can be used in combination with other parameters to verify the purchase with the iap server code snippet webapis inapppurchase startpayment "item_id", "iap_commercial_mode", successcallback, errorcallback ; /* success callback */ function successcallback item { console log "item id " + item mitemid ; console log "item name " + item mitemname ; console log "item price " + item mitemprice ; } /* error callback */ function errorcallback error { /* error handling */ } get a list of purchased items to get all purchased items from galaxy stroe, use the getpurchaseditemlist or getpurchaseditemlistbyids method for getpurchaseditemlist , pass in the index of the first and last item, the item type, the start and end date, the callback function, and user data as parameters for getpurchaseditemlistbyids , pass in the item ids separated by comma , , the callback function, and user data as parameters when the reply is delivered, the getitemsuccesscallback or errorcallback callback is invoked with the jsonobject that stores the query results request for details, see the getpurchaseditemlist and getpurchaseditemlistbyids void getpurchaseditemlist long startnumber, long endnumber, tzdate startdate, tzdate enddate, getitemsuccesscallback successcallback, optional errorcallback? errorcallback void getpurchaseditemlistbyids domstring[] itemids, getitemsuccesscallback successcallback, optional errorcallback? errorcallback response [callback=functiononly, nointerfaceobject] interface getitemsuccesscallback { void onsuccess jsonobject result ; }; [callback=functiononly, nointerfaceobject] interface errorcallback { void onerror webapierror error ; }; common result key value type description merrorcode int error code number merrorstring string error message _items array item list purchased item details key value type description mitemid string item id numberthis is the same as the item id used in the request mitemname string name provided during the item registration in the seller portal mitemprice string item price in a local currency mitempricestring string currency code + price mcurrencyunit string device user currency unit mcurrencycode string currency code mitemdesc string item description provided during the item registration mitemimageurl string item image url provided during the item registration mitemdownloadurl string item download url provided during item registration mtype string item type 00 consumable01 non-consumable02 non-recurring subscription03 auto-recurring subscription10 all mpaymentid string id of the payment mpurchaseid string id of the purchase mpurchasedate string date of purchasefor example "2013-11-15 10 31 23" msubscriptionenddate string if the item type mtype is 02 or 03, this is the due date mjsonstring string original json string code snippet webapis inapppurchase getpurchaseditemlist 1, 10, new tizen tzdate 2020, 01, 01 , new tizen tzdate 2022, 12,31 , successcallback, errorcallback ; // item ids can be obtained by seperating the values returned by the getitemlist with comma , webapis inapppurchase getpurchaseditemlistbyids "item1,item2,item3", successcallback, errorcallback ; /* success callback */ function successcallback result { if result _items length == 0 { console log "no item" ; } else { for var i = 0; i < result _items length; i++ { console log "item id " + result _items[i] mitemid ; console log "item name " + result _items[i] mitemname ; console log "item price " + result _items[i] mitemprice ; } } } /* error callback */ function errorcallback error { /* error handling */ } handling errors during the iap process, various errors can occur, for example, due to an unstable network, connection error, invalid account, or invalid product if an error occurs, your application receives the webapierror error type in the errorcallback callback handle all errors appropriately error code error name description paymentiscancelederror payment canceled networkerror network is not available ioerror ioexception timeouterror timeout exception initializationerror failure during iap initialization needappupgradeerror samsung iap upgrade is required alreadypurchasederror error when a non-consumable product is repurchased or a subscription product is repurchased before the product expiration date whilerunningerror error when payment is requested without bundle information productdoesnotexisterror error when the requested item list is not available confirminboxerror the payment result is not received after requesting payment from the server, and the purchased item list is not confirmed notexistlocalpriceerror the item is not for sale in the country notavailableshoperror iap is not supported in the country invalidvalueserror invalid parameter notsupportederror the device does not support iap securityerror this functionality is not allowed unknownerror any other error case verify a purchase this server api enables your server and client app to verify that a specified in-app item purchase and payment transaction were successfully completed the api returns a json object with a successful status and details about a successful transaction and the item or with a failure status this api can help to prevent malicious purchases and ensure that purchase and payment transactions were successful when the client app experiences network interruptions after an item purchase and payment transaction request https //iap samsungapps com/iap/appsitemverifyiapreceipt as?protocolversion=2 0&purchaseid={purchaseid} the purchaseid is assigned by samsung iap your app receives it in the jsonobject of paymentsuccesscallback and the variable name is mpurchaseid response note response parameters may be added, changed, and deleted success { "itemid" "item01", "paymentid" "zpmtid20131122gbi0015292", "orderid" "s20200106kra1908790", "itemname" "test pack", "itemdesc" "iap test item best value!", "purchasedate" "2020-11-22 04 22 36", "paymentamount" "9 000", "status" "true", "paymentmethod" "credit card", "mode" "real", } fail { "status" "false" } note besides verifying a purchase, samsung iap server api also obtains service token information and gets detailed information of auto recurring subscription ars item purchase submit the app to galaxy store 1 check the operation mode after iap integration, you must check the operation mode before submitting the app if you submit the app with iap_success_test_mode, the users will get all the items for free so, before beta release or normal publication, confirm if the operation mode is iap_commercial_mode 2 submit the app when you have created an app version that is ready for review testing and normal publication, register the app and its in-app item, and then click submit for more details, see the app registration guide
Develop Mobile Samsung Automation
docsamsung automation studio get started - samsung automation studio beta the automation studio allows you to integrate samsung bixby, smartthings and 3rd party your apis connect it with samsung bixby and smartthings! you can start a free trial the 6th promotion will end when the free trial code we have prepared are exhausted samsung account a samsung account is your gateway to the world of samsung when you sign up for a samsung account, you gain access to apps and services of samsung smartthings support samsung automation studio supports smartthings integration via smartthings node customization bixby voice support bixby voice can execute your flow that designed with "capsule label" node and "capsule result" node securely stored manage and store your flows simply export and import all files are encrypted and securely stored, protect in what matters pre-defined flows start with pre-defined flow templates for a mashing-up various cases get inspiration and create your new flow runtime environment deploy your flows in secured and isolated containers whose healths and lifecycles are managed automatically by the reliable container platform cf bixby capsule support you can create a flow using the capsule label node and capsule result node you can run this flow using the capsule for automation studio we have already developed the capsule for automation studio it is listed on bixby marketplace remote-endpoint makes your business logic more flexible on bixby voice "capsule label" node allows you to call the remote-endpoint without developing a capsule use a remote-endpoint to your capsules? get a paradigm shift when using bixby and its platform for an advanced state of conversational ai and voice jump on the bixby train and be ready for the 500 million, bixby-enabled, samsung devices that ships yearly as these are enabled with remote-endpoints making it more to flexibly code on bixby capsules capsule node decide which name is called through bixby voice without developing a capsule learn more > smartthings support webhook endpoints in this context is a web services application it serves as an api endpoint on the internet, that receives incoming http post requests webhook endpoints must be an https url rapidly build a smartapp by connecting devices and smartthings services easily what is the automation? automation allows the user to control their smartthings ecosystem without any manual intervention an example of an automation is a webhook that uses the smartthings rest api to control and get status notifications from smartthings devices automation node connect easily with the smartthings smartapp using a web hook endpoint deviceprofile node know what capability you need? find the 71 capabilities of smartthings learn more > get started you can start a free trial the 6th promotion will end when the free trial code we have prepared are exhausted *[sign up][1] for a samsung account, if you do not already have one the minimum requirements are samsung account signed up to smartthings or bixby developers get the subscription code development service level get free trial > use our node on your server! you can find our node named "samsung-automation-studio" in node-red community and can install it in node-red you can keep your flows through the import/export npm install node-red-contrib-samsung-automation-studio-nodes self-managed servers limited features learn more > get started - samsung automation studio beta
Develop Smart TV
api'tizen tv service adinfo adinfo' class reference tifa is a samsung smart tv identifier made and used for the purpose of providing advertising on samsung smart tvs you may collect and use the tifa and the personal information based on the tifa collectively 'tifa information' through your application for the following purposes collecting or using the tifa information for any other purpose is prohibited in-app advertisements installation of other applications through your in-app advertisement launching another application including apps already installed on the samsung smart tv , web browser or video player through your in-app advertisement collecting the app usage data related to the in-app advertisement e g in-app subscription, in-app contents purchasement, or etc for the purpose of analyzing in-app advertisement attribution in the event a user resets the tifa, you agree not to map or associate any previous tifa with the newly generated tifa 'mapping' means tracking and identifying any previous tifa with the newly generated tifa you agree not to connect the tifa to personally-identifiable information or associated with any persistent device identifier e g duid, mac address, etc you agree to use encrypted protocol e g https when the tifa is sent outside the device you agree to comply with all applicable privacy and data protection laws and regulations including getting prior consent from the user regarding your collection and use of the tifa information you may be unable to register your application on the samsung smart tv, or your registration may be cancelled if you are found to be in violation of the above said obligations i agree and commit to comply with all policies and restrictions regarding tifa and tv ad platform listed in this page also i agree to t&cs of d-forum linked in the bottom of the website public static functions string gettifa tifa is a randomized, non-persistent, and resettable samsung smart tv device identifier the personal information collected for the purpose of providing advertisement is linked to tifa collectively "tifa information" tifa shall be collected and used only for the following purposes any other purpose is prohibited more bool islatenabled checks whether the device has limited ad tracking this api is also available in net version 4 4 3 and later more string getuuid get universally unique identifier uuid different uuid values are generated for each app uuid shall not be used for advertising purpose if your app collects and uses both uuid and tifa, they shall be transferred by separate streaming when each of such identifiers is sent outside of the device also, uuid and tifa shall be separated in the entire data processing procedure, including storage, utilization, processing and deletion within the server the collection and use of the uuid shall be in compliance with all applicable privacy and data protection laws and regulations including getting prior consent from the user this api is also available in net version 4 4 3 and later more public static functions string gettifa tifa is a randomized, non-persistent, and resettable samsung smart tv device identifier the personal information collected for the purpose of providing advertisement is linked to tifa collectively "tifa information" tifa shall be collected and used only for the following purposes any other purpose is prohibited in-app advertisements installation of other applications through your in-app advertisement running another application including apps already installed on the samsung smart tv , web browser or video player through your in-app advertisement collecting the app usage data related to the in-app advertisement e g in-app subscription, in-app contents purchasement, or etc for the purpose of analyzing in-app advertisement attribution tifa will be newly generated whenever user resets the tifa, and you shall agree not to map any previous tifa with the newly generated tifa "mapping" means tracking and identifying any previous tifa with the newly generated tifa the encrypted protocol e g https shall be used when the tifa is sent outside of the device tifa shall not be connected to personally-identifiable information or associated with any persistent device identifier e g duid, mac address, etc the collection and use of the tifa information shall be in compliance with all applicable privacy and data protection laws and regulations including getting prior consent from the user this api is also available in net version 4 4 3 and later returns string id for advertising exceptions exception thrown when check privilege failed invalidoperationexception thrown when psid has wrong value privilege http //developer samsung com/privilege/adinfo privilege level public legal review result legal review completed details have been added to the description product tv version 5 5 0 sdk support y bool islatenabled checks whether the device has limited ad tracking this api is also available in net version 4 4 3 and later returns boolean value to indicate whether limited ad tracking is set true limit ad tracking false not limit ad tracking exceptions exception thrown when check privilege failed privilege http //developer samsung com/privilege/adinfo privilege level public legal review result legal review completed details have been added to the description product tv version 5 5 0 sdk support y string getuuid get universally unique identifier uuid different uuid values are generated for each app uuid shall not be used for advertising purpose if your app collects and uses both uuid and tifa, they shall be transferred by separate streaming when each of such identifiers is sent outside of the device also, uuid and tifa shall be separated in the entire data processing procedure, including storage, utilization, processing and deletion within the server the collection and use of the uuid shall be in compliance with all applicable privacy and data protection laws and regulations including getting prior consent from the user this api is also available in net version 4 4 3 and later returns randomized 36 characters uuid privilege none privilege level non-privilege legal review result legal review completed details have been added to the description product tv version 5 5 0 sdk support y
Develop Samsung IAP
docsamsung iap publish api the samsung iap publish api is used to view, register, modify, and remove samsung in-app purchase iap items before you can start using the iap publish api, you must meet all requirements and use the required authorization header parameters in your requests see get started with the iap apis for more information noteusing the iap publish api to register, modify, or delete an item immediately changes it within the content, even when the content is in the for sale state the publish api can only be used for item product types it cannot be used for subscription product types see the iap programming guide for more information about item and subscription product types the following is a quick reference to the iap publish apis name request description view item list get /iap/v6/applications/ packagename/items request a list of item information within a scope appropriate for the page and size view individual item get /iap/v6/applications/ packagename/items/ id request detailed information on one item create item post /iap/v6/applications/ packagename/items register an in-app item modify item put /iap/v6/applications/ packagename/items modify an in-app item partial item modification patch /iap/v6/applications/ packagename/items modify the specified parameters of an in-app item remove item delete /iap/v6/applications/ packagename/items/ id remove an in-app item see in-app purchase for more information about iap functionality in seller portal view item list request a list of item information within a scope appropriate for the page and size request get /iap/v6/applications/ packagename/items?page={}&size={} name type in description page int query required number of pages of content to return size int query required number of items to be returned on a page curl \ -x get \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ "https //devapi samsungapps com/iap/v6/applications/com package name/items?page=1&size=20" response parameters name type description id string unique identifier of the in-app item registered in seller portal title string title of the in-app item registered in seller portal description string brief explanation of the in-app item registered in seller portal type string in-app item type item goods and services that charge users on a one-time basis non_consumable an item that is purchased only once and remains effective or available in the app at all times, even after deletion and re‑installation of the app for example, game boards or an upgrade starting from june 2025, the non_consumable type has been deprecated, and the ability to register new non-consumable items through the publish api will no longer be possible please refer to the programming guide for more information status string item distribution status in seller portal published item is for sale in galaxy store unpublished item is not available in galaxy store removed item has been removed from galaxy store itempaymentmethod phonebillstatus boolean whether or not the item is paid with an automatic payment on a phone bill true the item is paid by an automatic payment on a phone bill false the item is not paid by an automatic payment on a phone bill usdprice number the base price in usd united states of america dollars of the item the price can be set between 0 and 999 99 prices[] countryid string three-character country code iso 3166 of the country where the item is sold prices[] currency string three-character currency code iso 4217 of the specified country's currency for example, eur, gbp, usd prices[] localprice string price of the item in the specified country's currency totalcount number number of items listed in the response success status 200 success { "itemlist" [ { "id" "one_gallon_gas", "title" "1 gallon gas", "description" "fuel for driving game", "type" "item", "status" "published", "itempaymentmethod" { "phonebillstatus" true }, "usdprice" 0 900, "prices" [ { "countryid" "kor", "currency" "krw", "localprice" "1000 000" }, { "countryid" "usa", "currency" "usd", "localprice" "0 900" }, ] }, ], "totalcount" 3 } see failure response codes for a list of possible response codes when a request fails view individual item request detailed information about one item request get /iap/v6/applications/ packagename/items/ id name type description id string required unique identifier of the in-app item registered in seller portal curl \ -x get -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ "https //devapi samsungapps com/iap/v6/applications/com package name/items/one_gallon_gas" response see view item response parameters for a description of the response parameters success status 200 success { "id" "one_gallon_gas", "title" "1 gallon gas", "description" "fuel for driving game", "type" "item", "status" "published", "itempaymentmethod" { "phonebillstatus" true }, "usdprice" 0 900, "prices" [ { "countryid" "kor", "currency" "krw", "localprice" "1000 000" }, { "countryid" "usa", "currency" "usd", "localprice" "0 900" }, ] } see failure response codes for a list of possible response codes when a request fails create item register an in-app item request post /iap/v6/applications/com package name/items name type description id string required unique identifier of the in-app item registered in seller portal title string required title of the in-app item registered in seller portal description string required brief explanation of the in-app item registered in seller portal type string optional in-app product type item goods and services that charge users on a one-time basis status string required item distribution status in seller portal published item is for sale in galaxy store unpublished item is not available in galaxy store removed item has been removed from galaxy store itempaymentmethod phonebillstatus boolean required whether or not the item is paid with an automatic payment on a phone bill true the item is paid by an automatic payment on a phone bill false the item is not paid by an automatic payment on a phone bill usdprice number required the base price in usd united states of america dollars of the item the price can be set between 0 and 999 99 prices[] countryid string required three-character country code iso 3166 of the country where the item is sold prices[] currency string three-character currency code iso 4217 of the specified country's currency for example, eur, gbp, usd prices[] localprice string required price of the item in the specified country's currency curl \ -x post \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"id" "one_gallon_gas","title" "1 gallon gas","description" "fuel for driving game","type" "item","status" "published","itempaymentmethod" {"phonebillstatus" true},"usdprice" 0 99,"prices" [{"countryid" "kor","currency" "krw","localprice" "1000"},{"countryid" "usa","currency" "usd","localprice" "0 99"}]}' \ "https //devapi samsungapps com/iap/v6/applications/com package name/items" response success status 200 success { "id" "one_gallon_gas", "type" "item", "status" "published", "prices" [ { "countryid" "kor", "currency" "krw", "localprice" "1000 000" }, { "countryid" "usa", "currency" "usd", "localprice" "0 99" }, ] } see failure response codes for a list of possible response codes when a request fails modify item modify an in-app item the request replaces all existing information, except the content id, of the item tipto modify an app, use the response from view individual item to create the input required for this request request put /iap/v6/applications/ packagename/items see create item request for a description of the request parameters curl \ -x put \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"id" "one_gallon_gas","title" "1 gallon gas","description" "fuel for driving game fix","type" "item","status" "published","itempaymentmethod" {"phonebillstatus" true},"usdprice" 1,"prices" [{"countryid" "kor","currency" "krw","localprice" "1000"},{"countryid" "usa","currency" "usd","localprice" "1"}]}' \ "https //devapi samsungapps com/iap/v6/applications/com package name/items" response success status 200 success { "id" "one_gallon_gas", "type" "item", "status" "published", "prices" [ { "countryid" "kor", "currency" "krw", "localprice" "1000 000" }, { "countryid" "usa", "currency" "usd", "localprice" "1" }, ] } see failure response codes for a list of possible response codes when a request fails partial item modification modify the title, countryid, or localprice of an in-app item the id cannot be modified parameters that are not specified are not modified request patch /iap/v6/applications/ packagename/items name type description id string required unique identifier of the in-app item registered in seller portal title string title of the in-app item registered in seller portal prices[] countryid string three-character country code iso 3166 of the country where the item is sold prices[] localprice string price of the item in the specified country's currency curl \ -x patch \ -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ -d '{"id" "one_gallon_gas","title" "2 gallon gas"}' \ "https //devapi samsungapps com/iap/v6/applications/com package name/items" response success status 200 success { "id" "one_gallon_gas", "type" "item", "status" "published" } see failure response codes for a list of possible response codes when a request fails remove item remove an in-app item request delete /iap/v6/applications/ packagename/items/ id name type in description id string path required unique identifier of the in-app item registered in seller portal curl \ -x delete -h "content-type application/json" \ -h "authorization bearer <your-access-token>" \ -h "service-account-id <your-service-account-id>" \ "https //devapi samsungapps com/iap/v6/applications/com package name/items/one_gallon_gas" response success status 200 ok { "id" "one_gallon_gas" } see failure response codes for a list of possible response codes when a request fails failure response codes the following are response codes you may see when the request fails status code and message 400bad request 109 subscription is not yet supported117 price is under minimum value for example, the local price of 0 69 is lower than the minimum price of 0 99 118 price is lower than minimum unit for example, the local price of 1 099 does not match the minimal price unit of 0 01119 price exceeds maximum value120 non-consumable type is no longer supported400 bad request with wrong in-app product information 401unauthorized 101 user doesn't have permission to change this app103 failed to verify gateway server authorization 404not found 104 content doesn't exist please create content first 106 itemgroup doesn't exist in production level need to publish iap-supported app 110 product does not exist 409conflict 105 the product already exists with the requested id107 there are multiple itemgroupids or itemids with the requested packagename
Develop Smart Hospitality Display
apiavplay api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html this module defines the multimedia player functionalities provided by the tizen samsung tv product api since 2 3 product tv, av, b2b summary of interfaces and methods interface method avplaymanagerobject avplaymanager void open domstring url ;void close ;void prepare ;void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ;void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ;avplayvideoseamlessinfo getvideoseamlessinfo ;avplayvideosize getvideosize ;avplaycodecinfo getcodecinfo ;void play ;void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void stop ;avplayplayerstate getstate ;avplayplayerstate getsubstate ;void pause ;void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;unsigned long getduration ;unsigned long getcurrenttime ;void settimeoutforbuffering unsigned long seconds ;void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ;void setspeed long playbackspeed ;void setlistener avplayplaybackcallback playbackcallback ;domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ;domstring getuid avplaydrmtype drmtype ;void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ;void unsetsoundanalysislistener ;void setsilentsubtitle boolean onoff ;void setexternalsubtitlepath domstring filepath ;void setsubtitleposition long position ;void setdisplaymethod avplaydisplaymode displaymode ;void setselecttrack avplaystreamtype tracktype, long trackindex ;avplaystreaminfo[] getcurrentstreaminfo ;avplaystreaminfo[] gettotaltrackinfo ;void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ;domstring getstreamingproperty avplaystreamingpropertytype propertytype ;domstring getversion ;void suspend ;void setlooping boolean islooping ;void setseamlesslooping ;void setvideostillmode domstring mode ;void setdisplayrotation domstring displayrotation ;void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ;void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ;void enableaudiostream ;void disableaudiostream ;void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; avplayplaybackcallback void onbufferingstart ;void onbufferingprogress unsigned long percent ;void onbufferingcomplete ;void oncurrentplaytime unsigned long currenttime ;void onstreamcompleted ;void onevent avplayevent eventid, domstring data ;void onerror avplayerror eventid ;void onerrormsg avplayerror eventid, domstring errormsg ;void ondrmevent avplaydrmtype type, drmdata data ;void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ;void onresourceconflicted ; avplaysoundanalysiscallback void ongetexception webapierror err ;void onsetexception webapierror err ;void ongetbandsarray long[] band ; 1 type definitions 1 1 avplayplayerstate specifies the player state enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; the following values are supported none player is not created idle player is created but not prepared ready player is ready to play media playing player is playing media paused player is paused 1 2 scantype specifies the video scan type enum scantype { "interlaced", "progressive" }; the following values are supported interlaced video scanning type is interlaced progressive video scanning type is progressive 1 3 avplaydisplaymode specifies display modes enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; the following values are supported player_display_mode_letter_box letterbox mode player_display_mode_full_screen full-screen mode player_display_mode_auto_aspect_ratio screen mode based on video dar/par info 1 4 avplaybufferoption specifies buffering scenarios enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; the following values are supported player_buffer_for_play initial buffering scenario player_buffer_for_resume re-buffering which might be occured after initial buffering during the playback the onbufferingcomplete event would be triggered when the player_buffer_for_play amount of data is buffered the actual buffering completion time may vary depending on the contents format, bitrate, network speed and so on 1 5 avplaybuffersizeunit specifies buffer size units enum avplaybuffersizeunit { "player_buffer_size_in_second" }; the following values are supported player_buffer_size_in_second buffer size in seconds remark "player_buffer_size_in_byte" property has been deprecated from tizen version 5 0 1 6 avplaystreamingpropertytype specifies parameters for various streaming protocols, such as http, mms, and adaptive streaming smooth streaming, hls, and mpeg-dash enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; the following values are supported cookie http request cookie used to establish the session with the http server for setstreamingproperty user_agent http user agent, used in the http request header for setstreamingproperty prebuffer_mode property to initiate prebuffering mode the second parameter indicates start-time for prebuffered content, in milliseconds for setstreamingproperty adaptive_info sets a custom streaming url with various streaming parameters, such as "bitrates", "startbitrate", or "skipbitrate" for setstreamingproperty string containing custom attributes for adaptive streaming playback "startbitrate=" valid values are "lowest", "highest", and "average" you can also define a specific bandwidth for the start of playback "bitrates=" use '~' to define a bandwidth range 5000 ~ 20000 you can also define a specific bandwidth for playback "skipbitrate=" defines the bandwidth to use after a skip operation "startfragment=" for live content playback, defines the start fragment number "fixed_max_resolution=max_widthxmax_height" only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, application should use this attribute to complete the resolution information for the player set_mode_4k forces the player to use the 4k uhd decoder its parameter can be the string "true" or "false" for setstreamingproperty in the case of adaptive streaming which requires stream-change for different video resolution during the playback, only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, pass true with this property in idle state listen_sparse_track for the smooth streaming case, configures the player to listen for a "sparse name" configured through "propertyparam" the sparse track name is a string for setstreamingproperty is_live whether the stream is live or vod applicable to all streaming types for getstreamingproperty available_bitrate string listing the available bit-rates for the currently-playing stream for getstreamingproperty get_live_duration string describing the duration of live content for getstreamingproperty current_bandwidth string describing the current streaming bandwidth for getstreamingproperty use_videomixer property used for enabling/initializing video mixer feature on b2b product only for setstreamingproperty it should be set before setting set_mixedframe property on the player set_mixedframe property to set the position of mixed frame for setstreamingproperty setdisplayrect with required position on corresponding player instance to be called before setting this property portrait_mode property to force the playback the video in potrait mode on b2b proudct only for setstreamingproperty in_app_multiview property to select the scaler type, by default main scaler selected remark "in_app_multiview" is available since tizen version 7 0 "get_live_duration" is available since tizen version 2 4 "widevine" property has been deprecated from tizen version 4 0 "property_hd_audio" property has been deprecated from tizen version 2 4 "set_vr360_mode" property has been deprecated from tizen version 5 0 "set_mode_4k" property has been deprecated from tizen version 5 0 for retail tv property "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" has been available since 5 0 as an alternative "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" is available since tizen version 5 0 and api version 4 1 calling setstreamingproperty with set_mode_4k with parameter "true" is same as setting "adaptive_info" with attribute "fixed_max_resolution=3840x2160" 1 7 avplaydrmtype specifies drm systems supported by the player enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; the following values are supported playready playready verimatrix verimatrix widevine_cdm widevine modular 1 8 avplaydrmoperation specifies various drm operations enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; the following values are supported setproperties sets drm instance properties and initialize the drm instance for playready, verimatrix, and widevine cdm installlicense base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator initialize the playready drm instance widevine_license_data base64-encoded license data with given session id for widevine cdm an application shall retrieve license data using challenge data received in ondrmevent callback drm type drm operation json parameters value description playready setproperteis deletelicenseafteruse boolean true/false true delete the used license from tv storage after use false do not delete the used license from tv storage after use setproperties genchallenge boolean true/false true execute playready genchallenge case avplay will configure challenge data and provide challenge data through ondrmevent callback applications are responsible for communicating with license server and getting license after getting license, applications must perform “installlicense” drm operation via setdrm avplay api false execute playready getrights case in this case, playready will communicate with license server, get license and install license applications do not need to perform “installlicense” drmoperation setproperties cookie string set cookies setproperties customdata string set custom data setproperties licenseserver string set license server url for contents setproperties httpheader string set http header that the license server requires setproperties useragent string set user agent to be used setproperties soapheader string set soap header that the license server requires installlicense string set base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator this has been deprecated since 2019 initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 verimatrix setproperties companyname string set company name setproperties iptv string set license server url for iptv setproperties web string set license server url for webclient setproperties clienttype string set client type the value can be "web", "web-hls", "web-dash", or "iptv" verimatrix supports only “iptv”, “web” and “web-hls” initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 widevine cdm setproperties appsession string set session id string for the session established between an application and a server, earlier known as “widevine_app_session” setproperties datatype string set the data type such as "matroska_webm" or "mpeg-dash", earlier known as "widevine_data_type" widevine_license_data string set license data it accepts string type data that contains base64-encoded license data initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 remark 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example 1 9 avplaystreamtype specifies stream types supported by the player enum avplaystreamtype { "video", "audio", "text" }; the following values are supported video video track audio audio track text subtitle track 1 10 avplayerror specifies the player error messages enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; the following values are supported player_error_none operation has successfully completed; no error player_error_invalid_parameter unable to find the parameter player_error_no_such_file unable to find the specified media content player_error_invalid_operation invalid api call at the moment player_error_seek_failed failed to perform seek operation, or seek operation called during an invalid state player_error_invalid_state avplay api method was called during an invalid state player_error_not_supported_file multimedia file type not supported player_error_not_supported_format multimedia file format not supported player_error_invalid_uri input uri is in an invalid format player_error_connection_failed failed multiple attempts to connect to the specified content server player_error_genereic failed to create the display window 1 11 avplayevent specifies player events enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; the following values are supported player_msg_none notifies that a multimedia component message was not recognized by the player player_msg_resolution_changed during adaptive streaming playback, notifies that the video resolution has changed player_msg_bitrate_change during adaptive streaming playback, notifies of a change, based on network heuristics, in the bandwidth-specific url the current bandwidth value is also sent player_sparse_track_detect during adaptive streaming playback, notifies that a sparse track was encountered player_streaming_event posts required streaming data player_msg_http_error_code describes the detailed http network situation information player_msg_drm_challenge_data for encrypted content playback, posts the drm challenge data player_msg_cue_tag_info during adaptive streaming playback, notifies that the video is having a cue event to indicate the discontinuity due to ad event data is also sent sample event data "cue_tag_info {cueout-> timestamp 18000, expected adduration 18000}{cuein-> timestamp 36000, actual adduration 18000}" remark 'player_msg_fragment_info' event has been deprecated from tizen version 2 4, because it affects the application performance 1 12 avplaystreaminfo defines a dictionary for streaming video, audio and subtitle information for various streaming scenarios dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; the following values are supported index unsigned long index type track type audio, video, or text extra_info domstring json string containing all media-related info such as height, width, and fourcc for a video stream, and bitrate, fourcc, language, and codec type for an audio stream 1 13 avplaysubtitleattribute defines a dictionary for subtitle attributes dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; the following values are supported attr_type attribute type domstring json start_pos start position stop_pos stop position 1 14 avplayvideoseamlessinfo defines a dictionary for auto rotate degree and scan_type of video playback information dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; the following values are supported scan_type scantype of the video value is 0 interlaced or 1 progressive rotation_degree auto rotate degree of the video value can be 0,90,180,270 1 15 avplayvideosize defines a dictionary for video size information dictionary avplayvideosize { unsigned long width; unsigned long height; }; since 10 0 the following values are supported width width video width in pixels height height video height in pixels 1 16 avplaycodecinfo defines a dictionary for codec information dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; since 10 0 the following values are supported audio_codec audio_codec audio codec string video_codec video_codec video codec string 2 interfaces 2 1 avplaymanagerobject defines a webapi object instance of the tizen samsung tv product api the webapis avplay object enables access to avplay api functionality [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; attributes readonly avplaymanager avplay avplay api namespace 2 2 avplaymanager provides methods for the avplay functionalities [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; avplayvideosize getvideosize ; avplaycodecinfo getcodecinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setseamlesslooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; methods open instantiates the player object with a content url as the input parameter void open domstring url ; product tv, av, b2b constraint can be called in the following states "none", "idle" parameters url content url for playback it can be an absolute local path or a remote url from a network-based stream server exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay open url ; } catch e { console log e } close destroys the player object void close ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay close ; } catch e { console log e } prepare prepares the media player for playback synchronously the player must already be created with a valid uri void prepare ; product tv, av, b2b constraint can be called in the following states "idle", "ready" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" with error type invalidaccesserror, if given url through open is valid, but not exist or not accessible due to network issue e g , webapis avplay open "http //abc" with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay prepare ; } catch e { console log e } prepareasync prepares the media player for playback asynchronously this method is preferred over prepare because it returns immediately and does not block the application thread during preparation when preparation is successful, the success callback is returned and the player is in ready state if preparation fails, the error callback returns the error value when prepareasync is used with "prebuffer_mode", successcallback is invoked when prebuffering is complete, instead of when preparation is complete void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle", "ready" parameters successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidaccesserror, if given url through open is valid, but not exist or network issue e g , webapis avplay open "http //abc" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay prepareasync successcallback, errorcallback ; setdisplayrect sets the display area for video content playback the 4 parameters specify the left side, top, window width, and window height based on a 1920 x 1080 resolution screen, regardless of the actual application resolution void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" when app is using normal calling sequence , open+setdisplay+prepare etc parameters x display area top-left x-coordinate must be less than the tv screen width y display area top-left y-coordinate must be less than the tv screen height width display area width must be less than the tv screen width height display area height must be less than the source image height exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains a negative value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setdisplayrect 0, 0, 1920, 1080 ; } catch e { console log e } getvideoseamlessinfo retrieves the video auto rotate degree and scan_type from demux side avplayvideoseamlessinfo getvideoseamlessinfo ; product b2b lfd constraint can be called in the following states "idle", "ready", "playing", "paused" return value avplayvideoseamlessinfo avplayvideoseamlessinfo current version remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details starting from 10 0, api is supported in tv and av exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 6 5 code example //getvideoseamlessinfo / getvideosize / getvideosize usage example //1 initialize players var currentplayer = webapis avplaystore getplayer ; // current video playback var nextplayer = webapis avplaystore getplayer ; // next video playback //2 prepare current player in prebuffer mode currentplayer open 'http //www example com/example_1 mp4' ; currentplayer setdisplayrect x, y, width, height ; currentplayer setstreamingproperty "prebuffer_mode", "0" ; currentplayer prepare ; //or prepareasync currentplayer play ; // get current video info during prebuffer var currentvideoinfo = currentplayer getvideoseamlessinfo ; var currentscantype = currentvideoinfo scan_type; var currentrotation = currentvideoinfo rotation_degree; // 3 prepare next player in prebuffer mode nextplayer open 'http //www example com/example_2 mp4' ; nextplayer setdisplayrect x, y, width, height ; nextplayer setstreamingproperty "prebuffer_mode", "0" ; nextplayer prepare ; //or prepareasync // get next video info during prebuffer var nextvideoinfo = nextplayer getvideoseamlessinfo ; var nextscantype = nextvideoinfo scan_type; var nextrotation = nextvideoinfo rotation_degree; // 4 check compatibility based on scan type and rotation // - getvideoseamlessinfo can be called in prebuffer state // - compare current video scan_type_1 and rotation_degree_1 // - with next video scan_type_2 and rotation_degree_2 //alternative info sources // - getvideosize can be used for resolution checks // - getcodecinfo can verify codec compatibility var iscompatible = currentscantype === nextscantype && currentrotation === nextrotation ; // 5 apply still mode if compatible before transition if iscompatible { currentplayer setvideostillmode "true" ; } nextplayer play ; currentplayer stop ; getvideosize retrieves the video size information from demux side avplayvideosize getvideosize ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing", "paused" parameters avplayvideosize containing width and height remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var videosizeinfo = webapis avplay getvideosize ; var width = videosizeinfo width; var height = videosizeinfo height; } catch e { console log e } getcodecinfo retrieves the codec information from demux side avplaycodecinfo getcodecinfo ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters avplaycodecinfo containing audio_codec and video_codec remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var codecinfo = webapis avplay getcodecinfo ; var audiocodec = codecinfo audio_codec; var videocodec = codecinfo video_codec; } catch e { console log e } play starts stream playback, or resumes stream playback after pause void play ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" remark adaptive streaming using ts container for e g hls with audio sample rate changing across variants may cause audio loss exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay play ; } catch e { console log e } seekto skips playback to a specific timestamp for http streaming, this method is successful even when the specified timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing" buffered data is flushed and buffering starts over , "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call for live stream case, seek position must be within dvr range dvr range could be retrieved using get_live_duration property in getstreamingproperty api parameters milliseconds timestamp to skip to successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example try { webapis avplay seekto 10000,successcallback, errorcallback ; } catch e { console log e } // for live cases, get the live duration as var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; // seekpoint must be between starttime and endtime stop stops the player call this function after the video finishes playing void stop ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay stop ; } catch e { console log e } getstate retrieves the current player state avplayplayerstate getstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var bret = webapis avplay getstate ; getsubstate retrieves the current player including preloading state avplayplayerstate getsubstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "preload", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle","preload", "ready", "playing", "paused" exceptions webapiexception with error type unknownerror, for any other error since 9 0 code example try { webapis avplay open 'http //www example com/example_1 mp4' ; webapis avplay setdisplayrect x, y, width, height ; webapis avplay prepare ; var bret = webapis avplay getsubstate ; // bret should be preload console log "getsubstate state ["+ bret+"]" ; webapis avplay play ; } catch e { console log "getsubstate error "+e ; } pause pauses playback if this method is called successfully, current time updates are stopped void pause ; product tv, av, b2b constraint can be called in the following states "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type invalidaccesserror, if this api couldn't operate at the moment e g during the async operation such as seekto, etc with error type unknownerror, for any other error code example try { webapis avplay pause ; } catch e { console log e } jumpforward skips playback forward by a specific amount of time the player state is unchanged passing the optional callbacks is recommended for best performance, ensure that the previous call to this api was successful for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip forward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpforward 5000,successcallback, errorcallback ; jumpbackward skips playback backward by a specific amount of time the player state is unchanged for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip backward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpbackward 5000,successcallback, errorcallback ; getduration retrieves the total media duration unsigned long getduration ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number duration, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example duration = calcplaytime webapis avplay getduration function calcplaytime totalmilisec { var hours = math floor totalmilisec/3600000 ; var minutes = math floor totalmilisec - hours3600000 / 60000 ; var seconds = math floor totalmilisec - hours3600000 - minutes60000 / 1000 ; var milisec = totalmilisec - hours3600000 - minutes60000 - seconds1000 ; return { hours hours, minutes minutes, seconds seconds, milisec milisec, totalmilisec totalmilisec } } getcurrenttime retrieves the current playback time unsigned long getcurrenttime ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number current playback time, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var currentplaytime = webapis avplay getcurrenttime ; settimeoutforbuffering sets the stream buffering timeout when the specified amount of time has passed, the onbufferingcomplete callback is invoked, irrespective of buffering progress if not set using this method, the default buffer size is 32mb or 10 seconds of playable data, and 20 seconds time-out void settimeoutforbuffering unsigned long seconds ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters seconds buffering timeout duration, in seconds depending on network conditions, 3 to 10 seconds is recommended exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay settimeoutforbuffering 10 ; setbufferingparam sets the buffer size for the play and resume scenarios the time buffer size must be at least 4 seconds for example, if a 10 second buffer size is set, playback can only start or resume after 10 seconds of media has accumulated in the buffer play scenarios include user-initiated streaming playback and whenever media playback is starting for the first time resume scenarios include resuming playback after pause or seek operations, or when lack of data causes playback rebuffering void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; product tv, av, b2b constraint can be called in the following states "idle" parameters option "player_buffer_for_play" or "player_buffer_for_resume" unit "player_buffer_size_in_second" or "player_buffer_size_in_byte" amount data amount to be buffered, in seconds as specified by the unit parameter remark unit "player_buffer_size_in_byte" has been deprecated from tizen version 5 0 since tizen version 6 0, if first parameter contains a value which is not in avplaybufferoption enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if second parameter contains a value which is not in avplaybuffersizeunit enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if third parameter contains a value which is not unsigned long, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example // for the initial buffering webapis avplay setbufferingparam "player_buffer_for_play","player_buffer_size_in_second", 5 ; // 5 is in seconds // for the rebuffering webapis avplay setbufferingparam "player_buffer_for_resume","player_buffer_size_in_second", 15 ; // 15 is in seconds setspeed sets the current playback rate positive parameter values play the media forwards, while negative values cause the media to play in reverse the range of valid playback rates depends on the streaming protocol if the input parameter is out of range, the player returns the player_error_invalid_parameter flag void setspeed long playbackspeed ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" for the general http and https, the supported playback rate is -8x ~ 8x repeated seek please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters playbackspeed -16x, -8x, -4x, -2x, 1x, 2x, 4x, 8x, 16x exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setspeed 2 ; } catch e { console log e } setlistener sets asynchronous callback methods for player information notifications, such as buffering progress, player information, playback mode, and drm mode information void setlistener avplayplaybackcallback playbackcallback ; product tv, av, b2b constraint can be called in the following states "none", "idle" recommended , "ready", "playing", "paused" to avoid missing necessary information, the onbufferingstart, onbufferingprogress, onbufferingcomplete, onerror, onerrormsg, onevent, and ondrmevent listeners must be set during the "idle" state parameters playbackcallback avplayplaybackcallback remark all callback functions are optional user can add only the methods for necessary notifications exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type unknownerror, for any other error code example var listener = { onbufferingstart function { console log "buffering start " ; }, onbufferingprogress function percent { console log "buffering progress data " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, oncurrentplaytime function currenttime { console log "current playtime " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, onevent function eventtype, eventdata { console log "event type error " + eventtype + ", data " + eventdata ; }, onerror function eventtype { console log "event type error " + eventtype ; }, onerrormsg function eventtype,eventmsg { console log "event type error " + eventtype ; console log "event message " + eventmsg ; }, onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; }, ondrmevent function drmevent, drmdata { console log "drm callback " + drmevent + ", data " + drmdata ; }, onstreamcompleted function { console log "stream completed" ; } } webapis avplay setlistener listener ; setdrm updates the drm information, such as setproperties you can change the drm mode and run the control feature the avplaydrmoperation and jsonparam parameters depend on the drm type please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications for the supported drm domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; product tv, av, b2b constraint can be called in the following states "idle" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"playready", "verimatrix", "widevine_cdm" } drmoperation avplaydrmoperation string specifying the drm operation to be performed the valid values are depending on the drm types this is mainly used for setting drm information, such as the license server, application-specific custom data, soap or http header, the genchallenge mode, and license usage jsonparam domstring drm parameter represented by json string you can use the json stringify method to generate the json string return value domstring drmstring remark 'verimatrix' drm not supported web client since tizen 7 0 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state, "none" with error type unknownerror, for any other error examples of exception scenarios include an invalid drm session, or failure to create the underlying drm module or configuration in these scenarios, an exception is thrown and the method call returns false code example // implementing drm support // 1 playready example setting license server and custom data // 1 1 playready with genchallenge supported since tizen 4 0 var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { // take drmdata challenge to obtain license data } } } webapis avplay setlistener listener ; var appdata={deletelicenseafteruse true,getchallenge true,licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // the avplay will configure and provide challenged data through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' webapis avplay setdrm "playready", "installlicense", license_data ; // 1 2 playready without genchallenge var appdata={deletelicenseafteruse true, licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // 2 verimatrix example initializing verimatrix drm // application should call getuid only once and save it for further use, after every open api getuid need not be called if true { // since tizen version 5 0 domstring verimatrix_uid = webapis avplay getuid "verimatrix" ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "getuid", "" ; } // after open application should follow following sequence var drmparam = {}; drmparam companyname ="mycompany"; drmparam iptv="public2 verimatrix com"; drmparam web="public-ott-nodrm verimatrix com 80"; if true { // since tizen version 5 0 webapis avplay setdrm "verimatrix", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "initialize", json stringify drmparam ; } // 3 widevine modular example var sessionid; var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { sessionid = drmdata session_id; // take drmdata challenge and drmdata serverurl to obtain license data } } } webapis avplay setlistener listener ; var drmparam = {}; // sample session value; app must set there own session id drmparam appsession = "test-session"; drmparam datatype = "mpeg-dash"; if true { // since tizen version 5 0 webapis avplay setdrm "widevine_cdm", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "widevine_cdm", "initialize", "" ; webapis avplay setdrm "widevine_cdm", "widevine_app_session", drmparam appsession ; webapis avplay setdrm "widevine_cdm", "widevine_data_type", drmparam datatype ; } // the avplay will configure and provide challenged data and session id through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' var licenseparam = sessionid + "param_start_position" + license_data + "param_start_position"; webapis avplay setdrm "widevine_cdm", "widevine_license_data", licenseparam ; //in tizen 5 0 onwards use eme_widevine_cdm instead of using widevine_cdm getuid gets the device uid the input would be the drm type domstring getuid avplaydrmtype drmtype ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"verimatrix"} // only verimatrix is supported avplaydrmtype for getuid interface return value domstring domstring remark since tizen version 6 0, if input contains a value which is not in avplaydrmtype enum, typemismatcherror is thrown instead of invalidvalueserror its deprecated because verimatrix not supported web client since tizen 7 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 7 0 code example var verimatrixuid = webapis avplay getuid "verimatrix" ; //verimatrix example retrieving the verimatrix uid setsoundanalysislistener retrieves the audio spectrum analysis result every 30 ms you can use it for an equalizer effect video or in a partytv application the spectrum is analyzed across an array of 31 bands, of which bands[14] ~ bands[18] generally have the largest values void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; product tv, av, b2b constraint can be called in the following states "idle" parameters soundanalysiscallback avplaysoundanalysiscallback exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay setsoundanalysislistener soundanalysislistener ; function soundanalysislistener dataarray { // listener registered to and receiving data from avplay var barheight = 0; var absvalue = 0; var threshold = 70; for var i = 0; i < dataarray length; i++ { absvalue = math abs dataarray[i] ; if absvalue > threshold { barheight = main barcontainerheight; } else { barheight = math round absvalue/threshold main barcontainerheight ; } if barheight == 0 barheight = 1; document getelementbyid 'frequencybar' + i style height = barheight + 'px'; } console log "sound analysis " + dataarray tostring ; } unsetsoundanalysislistener unregisters the sound analysis listener void unsetsoundanalysislistener ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay unsetsoundanalysislistener ; setsilentsubtitle enables or disables external subtitles void setsilentsubtitle boolean onoff ; product tv, av, b2b constraint can be called in the following states "idle", "ready" when using the synchronous prepare method , "playing", "paused" parameters onoff boolean value true subtitles are hidden false subtitles are shown the application does not receive any subtitle-related events exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsilentsubtitle true ; setexternalsubtitlepath sets the local path for the external subtitle file only absolute local paths are supported if the subtitle file is stored remotely, you must first download the file to local storage, and pass the absolute local path void setexternalsubtitlepath domstring filepath ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters filepath absolute local path exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setexternalsubtitlepath uri ; setsubtitleposition adjusts external subtitle synchronization with the audio and video void setsubtitleposition long position ; product tv, av, b2b constraint can be called in the following states "playing", "paused" parameters position time delay in milliseconds the duration can be a positive or negative number; a positive delay displays the subtitles later, while a negative delay displays the subtitles sooner exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsubtitleposition position_millisec ; setdisplaymethod sets the video screen mode in the specified display area void setdisplaymethod avplaydisplaymode displaymode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displaymode "player_display_mode_letter_box", "player_display_mode_full_screen", or "player_display_mode_auto_aspect_ratio" remark since tizen version 6 0, if input contains a value which is not in avplaydisplaymode enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setdisplaymethod "player_display_mode_full_screen" ; setselecttrack switches audio or subtitle tracks during playback void setselecttrack avplaystreamtype tracktype, long trackindex ; product tv, av, b2b constraint can be called in the following states "ready" for smooth streaming only , "playing", "paused" for text tracks only the tracktype "text" is not supported for dash streaming parameters tracktype "audio" or "text" trackindex avplaystreaminfo index remark since tizen version 6 0, if first parameter contains a value which is not in avplaystreamtype enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 5 0, the tracktype "audio" is supported for dash streaming exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var totaltrackinfo = webapis avplay gettotaltrackinfo ; for var i=0; i<totaltrackinfo length; i++ { if totaltrackinfo type == 'text' { console log 'find subtitle track ' ; console log 'subtitle track index is ' + totaltrackinfo index ; console log 'subtitle track language is ' + totaltrackinfo extra_info track_lang ; } } // choose subtitle track index 2 webapis avplay setselecttrack 'text',2 ; getcurrentstreaminfo retrieves the currently-playing video, audio, or subtitle stream information, and notifies that a stream is playing avplaystreaminfo[] getcurrentstreaminfo ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo array of objects containing tracktype, extrainfo and index for the current stream remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var streaminfo = webapis avplay getcurrentstreaminfo ; var text = ''; for var i = 0; i < streaminfo length; i++ { text += 'index ' + streaminfo[i] index + ''; text += 'type ' + streaminfo[i] type + ''; text += 'extra_info ' + streaminfo[i] extra_info + ''; } // all streams have extra_info as a jsonstring // video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" // audio extra_info example "{"language" "en","channels" "2","sample_rate" "44100","bit_rate" "96000","fourcc" "aacl"}" // text subtitle extra_info example "{"track_num" "0","track_lang" "en","subtitle_type" "-1","fourcc" "ttml"}" // if the stream is invalid, the domstring is null and the index value is -1 gettotaltrackinfo retrieves the currently-playing stream information avplaystreaminfo[] gettotaltrackinfo ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo[] structure containing tracktype, extrainfo and index of current stream returns information for the all available tracks in the stream the information is returned in the following structure for video tracks "{"fourcc" "%s","width" "%u","height" "%u","bit_rate" "%u"}" for audio track "{"language" "%s","channels" "%d","sample_rate" "%d","bit_rate" "%d","fourcc" "%s"}" for subtitle tracks "{"track_num" "%d","track_lang" "%s","subtitle_type" "%d","fourcc" "%s"}" some of them are not constant value e g video width, height, and bit_rate, audio channels, sample_rate, and bit_rate for adaptive streaming such as hls, dash and smoothstreaming remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var trackinfo = webapis avplay gettotaltrackinfo ; var text = 'type of track info ' + typeof trackinfo + ''; text += 'length ' + trackinfo length + ''; for var i = 0; i < trackinfo length; i++ { text += 'index ' + trackinfo[i] index + ''; text += 'type ' + trackinfo[i] type + ''; text += 'extra_info ' + trackinfo[i] extra_info + ''; } setstreamingproperty sets specific feature values for http, mms, or specific streaming engine smooth streaming, hls, dash, divx plus streaming, or widevine the available streaming properties depend on the streaming protocol or engine use the custom_message property for streaming engine or cp-specific settings void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; product tv, av, b2b constraint can be called in the following states "idle" parameters propertytype { "cookie", "user_agent", "prebuffer_mode" , "adaptive_info", "set_mode_4k", "property_hd_audio", "listen_sparse_track", "widevine", "use_videomixer", "set_mixedframe", "portrait_mode" , "in_app_multiview" }; propertyparam value according to the propertytype e g "adaptive_info" propetytypes are "bitrates", "startbitrate", "skipbitrate" "in_app_multiview" propetytypes are "video_view_resource_main" , "video_view_resource_sub" remark "use_videomixer", "set_mixedframe" are only for product b2b and available from tizen 2 4 onwards "portrait_mode" is only for product b2b and available from tizen 3 0 onwards "widevine" unit has been deprecated from tizen version 4 0 "property_hd_audio" unit has been deprecated from tizen version 2 4 since tizen version 6 0, if first paramter contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example //smooth streaming example var bitratestring = "bitrates=5000~10000|startbitrate=highest|skipbitrate=lowest"; webapis avplay setstreamingproperty "adaptive_info", bitratestring ; //prebuffer mode example //player1 => playback of main content //player2 => playback of advertisement buffered the ad content before playback player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open 'http //www example com/example_1 mp4' ; player1 setdisplayrect x, y, width, height ; player1 prepare ; player1 play ; player2 open 'http //www example com/example_2 mp4' ; player2 setstreamingproperty "prebuffer_mode", "5000" ; player2 setdisplayrect x, y, width, height ; player2 prepare ; player1 stop ; player2 play ; //user-agent example webapis avplay setstreamingproperty "useragent", "samsungsmooth-agent/1 1" ; setting resolution information for hls/dash webapis avplay setstreamingproperty "adaptive_info", "fixed_max_resolution=7680x4320" ; //mixer example player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open url1 ; player1 setstreamingproperty "use_videomixer", "" ; //enable video mixer player1 setdisplayrect 17, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player1 prepare ; player1 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player1 play ; player2 open url2 ; player2 setstreamingproperty "use_videomixer", "" ; //enable video mixer player2 setdisplayrect 973, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player2 prepare ; player2 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player2 play ; // 2 video simulatenous play example in_app_multiview player1 = webapis avplaystore getplayer player2 = webapis avplaystore getplayer ; //player1 => playback of main content //player2 => playback of sub content player1 open mainurl ; player1 setlistener listener1 ; player1 setdisplayrect 0, 0, 1920, 1080 ; //player1 setstreamingproperty 'in_app_multiview','video_view_resource_main' ; //by default it will use main video resource player1 prepare ; player1 play ; player2 open suburl ; player2 setlistener listener2 ; player2 setdisplayrect 700, 0, 600, 400 ; player2 disableaudiostream ; player2 setstreamingproperty 'in_app_multiview','video_view_resource_sub' ; player2 prepare ; player2 play ; getstreamingproperty retrieves a specific property value obtained by the streaming engine smooth streaming, hls, dash, or widevine domstring getstreamingproperty avplaystreamingpropertytype propertytype ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" parameters propertytype avplaystreamingpropertytype { "is_live", "available_bitrate", "get_live_duration","current_bandwidth"}; return value domstring domstring property value remark since tizen version 6 0, if input contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror get_server_time_scale and get_absolute_server_time supported for smooth streaming only exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var text = 'available_bitrate ' + webapis avplay getstreamingproperty "available_bitrate" ; text += 'current_bandwidth ' + webapis avplay getstreamingproperty "current_bandwidth" + ''; text += 'is_live ' + webapis avplay getstreamingproperty "is_live" +''; @code var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; if starttime > targetseektime { if endtime < targetseektime { webapis avplay seekto targetseektime ; //ms } } getversion retrieves the avplay version domstring getversion ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value domstring domstring string current version exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var version = webapis avplay getversion ; suspend pauses the player state when the application is sent to the background saves the current statistics for the ongoing playback session void suspend ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore ; } } ; setlooping this method sets the player's looping status if the looping status is true, playback automatically restarts upon finishing if it is false, it won't the default value of looping status is false void setlooping boolean islooping ; product b2b lfd constraint can be called in the following states "idle","ready", "playing", "paused" parameters islooping the new looping status where true means looping and false means non-looping exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setlooping true ; setseamlesslooping this method sets the player's seamless looping status playback automatically restarts upon finishing default is false supported for local files with specific container types mp4/mkv/avi/mov/ts/tp many functions such as seek, speed control, and subtitles are disabled or not working properly during seamless looping void setseamlesslooping ; product tv, av, b2b constraint can be called in the following states "idle" remark must be called before 'ready' state for local files streaming is not supported supported container types mp4, mkv, avi, mov, ts, tp disables seek, speed control, and subtitles during seamless looping the setting will be reset during stop/close calls for seamless playback in the next session, call setseamlesslooping again otherwise, playback will proceed as normal exceptions webapiexception with error type invalidvalueserror, if the feature is called with http url because it is not supported with streaming content with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example webapis avplay setseamlesslooping ; setvideostillmode this method sets video still mode still mode is for freezing last frame in display buffer void setvideostillmode domstring mode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters mode the still mode value where "true" sets video still mode and "false" turns off video still mode exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setvideostillmode "true" ; setdisplayrotation this method sets the rotation settings of the video surface display if no display is set, no operation is performed use this method to change the video orientation to portrait mode this api call will change the origin of coordinates so, application should call setdisplayrect again after calling this api void setdisplayrotation domstring displayrotation ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displayrotation the rotation of the display the valid values for display rotation are "player_display_rotation_none", "player_display_rotation_90", "player_display_rotation_180", "player_display_rotation_270" exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setdisplayrotation "player_display_rotation_90" ; restore during multitasking, restores the player state when the application is resumed for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore url, 0, false ; } } ; restoreasync during multitasking, restores the player state when the application is resumed restoreasync is an asynchronous interface other api, restore is a synchronous interface which blocks the application thread this method is preferred over restore because it returns immediately and does not block the application thread during its restoration when player is restored successful, the success callback is returned and player resumed the playback from the restored playback position, state, properties etc if restoration fails, the error callback returns the error value application is required to make further calls to avplay on its success or failure callback happens for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; try { var successcallback = function { console log "success" ; } var errorcallback = function err { throw new error 'error ' + err name ; } webapis avplay restoreasync url, 0, false, successcallback, errorcallback ; } catch e { console log e } } } ; enableaudiostream api to enable audio stream of a particular player instance out of current playing player instances this api disables audio stream of current active player instance and then enable audio for the player instance for which enableaudiostream has been called void enableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay enableaudiostream ; } catch e { console log e } disableaudiostream api to disable audio stream of a particular player instance out of current playing player instances void disableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay disableaudiostream ; } catch e { console log e } setvideoroi sets the roi region of interest area of the content video source void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; product b2b lfd constraint can be called in the following states "ready, "playing", "paused" please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters x_ratio coordinate ratio value of x to the max video source width size, valid range is 0 0~1 0 y_ratio coordinate ratio value of y to the max video source height size, valid range is 0 0~1 0 w_ratio width ratio value of the video source area based on the video width size, valid range is from greater than 0 0 to 1 0 h_ratio height ratio value of the video source area based on the video height size, valid range is from greater than 0 0 to 1 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error with error type notsupportederror, if this api is called from a tv device application since 6 0 code example try { webapis avplay setvideoroi 0,0,0 5,0 5 ; } catch e { console log e } ; 2 3 avplayplaybackcallback defines callbacks for buffering and playback notifications [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; void onresourceconflicted ; }; methods onbufferingstart callback method for asynchronous buffering started notifications void onbufferingstart ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingstart function { console log "buffering start " ; } onbufferingprogress callback method for asynchronous buffering progress notifications void onbufferingprogress unsigned long percent ; parameters percent unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingprogress function percent { console log "buffering progress data " + percent ; } onbufferingcomplete callback method for asynchronous buffering complete notifications void onbufferingcomplete ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingcomplete function { console log "buffering complete " ; } oncurrentplaytime callback method for the current playback time void oncurrentplaytime unsigned long currenttime ; parameters currenttime unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example oncurrentplaytime function currenttime { console log "current playtime " + currenttime ; } onstreamcompleted callback method for asynchronous playback finished notifications void onstreamcompleted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onstreamcompleted function { console log "stream completed" ; } onevent callback method for asynchronous event notifications void onevent avplayevent eventid, domstring data ; parameters eventid avplayevent object data domstring exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onevent function eventtype, eventdata { console log "onevent callback with eventtype " + eventtype ; } onerror callback method for avplay error notifications void onerror avplayerror eventid ; parameters eventid avplayerror object exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onerror function eventtype { console log "onerror event callback with eventtype " + eventtype ; } onerrormsg callback method for avplay detailed error message notifications void onerrormsg avplayerror eventid, domstring errormsg ; parameters eventid is of type avplayerror enum, which is defined above errormsg domstring json string containing all media-related info with respect to the error scenario exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 6 0 code example onerrormsg function eventtype, errormsg { console log "onerrormsg event callback with eventtype " + eventtype + "error message " + errormsg ; } //errormsg example "{"error_code" "player_error_connection_failed","url" "http //www xxxxx m3u8","downloadspeed" "10mb/s", // "http_request_header" "xxxxxxxx","http_response_header" "xxxxxxxx", "connect_error" {"curl" -23}}" //errormsg example " {"error_code" "player_error_not_supported_format","codec" "h264","demux" "mp4demux", // "resolution" "19201080","fps" "30", "detail_info" "decoder error"}" ondrmevent callback method for drm information notifications void ondrmevent avplaydrmtype type, drmdata data ; parameters type avplaydrmtype object data drmdata exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example ondrmevent function drmtype, drmdata { console log "drm callback, type " + drmtype + ", data " + drmdata ; if drmdata name === 'challenge' { var challengedata = { "name" drmdata name, "session_id" drmdata session_id, "challenge" drmdata challenge, "challenge_len" drmdata challenge_len, "serv_url" drmdata serverurl, "serv_url_len" drmdata serverurl_len } // use challenge data to get drm license } else if drmdata name === 'drmerror' { var errorinfo = { "name" drmdata name, "error_code" drmdata code, "error_message" drmdata message // generally, it's human readable message } } } onsubtitlechange callback method for asynchronous subtitle change notifications void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; parameters duration how long the subtitle data should show unsigned long value in milliseonds subtitles domstring the actual subtitle data it can be of type text of type image type domstring of unsigned int value a value of '0' means subtitle data is of type text and '1' means subtitle data is of type image attributes array of avplaysubtitleattribute "attr_type" "attributetype value"; "start_pos" start position as long; "stop_pos" stop position as long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; } onresourceconflicted callback method for resource conflict notifications void onresourceconflicted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 10 0 code example onresourceconflicted function { console log "resource conflicted " ; } 2 4 avplaysoundanalysiscallback this callback interface specifies subscriptions for any notification for sound analysis [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; deprecated 2 4 methods ongetexception required for error handling void ongetexception webapierror err ; parameters err webapierror deprecated 2 4 onsetexception set for the error handling void onsetexception webapierror err ; parameters err webapierror deprecated 2 4 ongetbandsarray provide the band array[32] having sound effect information void ongetbandsarray long[] band ; parameters band long band array[32] having sound effect information deprecated 2 4 3 full webidl module avplay { enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; enum scantype { "interlaced", "progressive" }; enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; enum avplaybuffersizeunit { "player_buffer_size_in_second" }; enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; enum avplaystreamtype { "video", "audio", "text" }; enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; dictionary avplayvideosize { unsigned long width; unsigned long height; }; dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; }; [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; };
Develop Smart TV
apiavplay api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html this module defines the multimedia player functionalities provided by the tizen samsung tv product api since 2 3 product tv, av, b2b summary of interfaces and methods interface method avplaymanagerobject avplaymanager void open domstring url ;void close ;void prepare ;void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ;void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ;avplayvideoseamlessinfo getvideoseamlessinfo ;avplayvideosize getvideosize ;avplaycodecinfo getcodecinfo ;void play ;void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void stop ;avplayplayerstate getstate ;avplayplayerstate getsubstate ;void pause ;void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;unsigned long getduration ;unsigned long getcurrenttime ;void settimeoutforbuffering unsigned long seconds ;void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ;void setspeed long playbackspeed ;void setlistener avplayplaybackcallback playbackcallback ;domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ;domstring getuid avplaydrmtype drmtype ;void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ;void unsetsoundanalysislistener ;void setsilentsubtitle boolean onoff ;void setexternalsubtitlepath domstring filepath ;void setsubtitleposition long position ;void setdisplaymethod avplaydisplaymode displaymode ;void setselecttrack avplaystreamtype tracktype, long trackindex ;avplaystreaminfo[] getcurrentstreaminfo ;avplaystreaminfo[] gettotaltrackinfo ;void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ;domstring getstreamingproperty avplaystreamingpropertytype propertytype ;domstring getversion ;void suspend ;void setlooping boolean islooping ;void setseamlesslooping ;void setvideostillmode domstring mode ;void setdisplayrotation domstring displayrotation ;void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ;void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ;void enableaudiostream ;void disableaudiostream ;void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; avplayplaybackcallback void onbufferingstart ;void onbufferingprogress unsigned long percent ;void onbufferingcomplete ;void oncurrentplaytime unsigned long currenttime ;void onstreamcompleted ;void onevent avplayevent eventid, domstring data ;void onerror avplayerror eventid ;void onerrormsg avplayerror eventid, domstring errormsg ;void ondrmevent avplaydrmtype type, drmdata data ;void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ;void onresourceconflicted ; avplaysoundanalysiscallback void ongetexception webapierror err ;void onsetexception webapierror err ;void ongetbandsarray long[] band ; 1 type definitions 1 1 avplayplayerstate specifies the player state enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; the following values are supported none player is not created idle player is created but not prepared ready player is ready to play media playing player is playing media paused player is paused 1 2 scantype specifies the video scan type enum scantype { "interlaced", "progressive" }; the following values are supported interlaced video scanning type is interlaced progressive video scanning type is progressive 1 3 avplaydisplaymode specifies display modes enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; the following values are supported player_display_mode_letter_box letterbox mode player_display_mode_full_screen full-screen mode player_display_mode_auto_aspect_ratio screen mode based on video dar/par info 1 4 avplaybufferoption specifies buffering scenarios enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; the following values are supported player_buffer_for_play initial buffering scenario player_buffer_for_resume re-buffering which might be occured after initial buffering during the playback the onbufferingcomplete event would be triggered when the player_buffer_for_play amount of data is buffered the actual buffering completion time may vary depending on the contents format, bitrate, network speed and so on 1 5 avplaybuffersizeunit specifies buffer size units enum avplaybuffersizeunit { "player_buffer_size_in_second" }; the following values are supported player_buffer_size_in_second buffer size in seconds remark "player_buffer_size_in_byte" property has been deprecated from tizen version 5 0 1 6 avplaystreamingpropertytype specifies parameters for various streaming protocols, such as http, mms, and adaptive streaming smooth streaming, hls, and mpeg-dash enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; the following values are supported cookie http request cookie used to establish the session with the http server for setstreamingproperty user_agent http user agent, used in the http request header for setstreamingproperty prebuffer_mode property to initiate prebuffering mode the second parameter indicates start-time for prebuffered content, in milliseconds for setstreamingproperty adaptive_info sets a custom streaming url with various streaming parameters, such as "bitrates", "startbitrate", or "skipbitrate" for setstreamingproperty string containing custom attributes for adaptive streaming playback "startbitrate=" valid values are "lowest", "highest", and "average" you can also define a specific bandwidth for the start of playback "bitrates=" use '~' to define a bandwidth range 5000 ~ 20000 you can also define a specific bandwidth for playback "skipbitrate=" defines the bandwidth to use after a skip operation "startfragment=" for live content playback, defines the start fragment number "fixed_max_resolution=max_widthxmax_height" only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, application should use this attribute to complete the resolution information for the player set_mode_4k forces the player to use the 4k uhd decoder its parameter can be the string "true" or "false" for setstreamingproperty in the case of adaptive streaming which requires stream-change for different video resolution during the playback, only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, pass true with this property in idle state listen_sparse_track for the smooth streaming case, configures the player to listen for a "sparse name" configured through "propertyparam" the sparse track name is a string for setstreamingproperty is_live whether the stream is live or vod applicable to all streaming types for getstreamingproperty available_bitrate string listing the available bit-rates for the currently-playing stream for getstreamingproperty get_live_duration string describing the duration of live content for getstreamingproperty current_bandwidth string describing the current streaming bandwidth for getstreamingproperty use_videomixer property used for enabling/initializing video mixer feature on b2b product only for setstreamingproperty it should be set before setting set_mixedframe property on the player set_mixedframe property to set the position of mixed frame for setstreamingproperty setdisplayrect with required position on corresponding player instance to be called before setting this property portrait_mode property to force the playback the video in potrait mode on b2b proudct only for setstreamingproperty in_app_multiview property to select the scaler type, by default main scaler selected remark "in_app_multiview" is available since tizen version 7 0 "get_live_duration" is available since tizen version 2 4 "widevine" property has been deprecated from tizen version 4 0 "property_hd_audio" property has been deprecated from tizen version 2 4 "set_vr360_mode" property has been deprecated from tizen version 5 0 "set_mode_4k" property has been deprecated from tizen version 5 0 for retail tv property "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" has been available since 5 0 as an alternative "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" is available since tizen version 5 0 and api version 4 1 calling setstreamingproperty with set_mode_4k with parameter "true" is same as setting "adaptive_info" with attribute "fixed_max_resolution=3840x2160" 1 7 avplaydrmtype specifies drm systems supported by the player enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; the following values are supported playready playready verimatrix verimatrix widevine_cdm widevine modular 1 8 avplaydrmoperation specifies various drm operations enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; the following values are supported setproperties sets drm instance properties and initialize the drm instance for playready, verimatrix, and widevine cdm installlicense base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator initialize the playready drm instance widevine_license_data base64-encoded license data with given session id for widevine cdm an application shall retrieve license data using challenge data received in ondrmevent callback drm type drm operation json parameters value description playready setproperteis deletelicenseafteruse boolean true/false true delete the used license from tv storage after use false do not delete the used license from tv storage after use setproperties genchallenge boolean true/false true execute playready genchallenge case avplay will configure challenge data and provide challenge data through ondrmevent callback applications are responsible for communicating with license server and getting license after getting license, applications must perform “installlicense” drm operation via setdrm avplay api false execute playready getrights case in this case, playready will communicate with license server, get license and install license applications do not need to perform “installlicense” drmoperation setproperties cookie string set cookies setproperties customdata string set custom data setproperties licenseserver string set license server url for contents setproperties httpheader string set http header that the license server requires setproperties useragent string set user agent to be used setproperties soapheader string set soap header that the license server requires installlicense string set base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator this has been deprecated since 2019 initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 verimatrix setproperties companyname string set company name setproperties iptv string set license server url for iptv setproperties web string set license server url for webclient setproperties clienttype string set client type the value can be "web", "web-hls", "web-dash", or "iptv" verimatrix supports only “iptv”, “web” and “web-hls” initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 widevine cdm setproperties appsession string set session id string for the session established between an application and a server, earlier known as “widevine_app_session” setproperties datatype string set the data type such as "matroska_webm" or "mpeg-dash", earlier known as "widevine_data_type" widevine_license_data string set license data it accepts string type data that contains base64-encoded license data initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 remark 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example 1 9 avplaystreamtype specifies stream types supported by the player enum avplaystreamtype { "video", "audio", "text" }; the following values are supported video video track audio audio track text subtitle track 1 10 avplayerror specifies the player error messages enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; the following values are supported player_error_none operation has successfully completed; no error player_error_invalid_parameter unable to find the parameter player_error_no_such_file unable to find the specified media content player_error_invalid_operation invalid api call at the moment player_error_seek_failed failed to perform seek operation, or seek operation called during an invalid state player_error_invalid_state avplay api method was called during an invalid state player_error_not_supported_file multimedia file type not supported player_error_not_supported_format multimedia file format not supported player_error_invalid_uri input uri is in an invalid format player_error_connection_failed failed multiple attempts to connect to the specified content server player_error_genereic failed to create the display window 1 11 avplayevent specifies player events enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; the following values are supported player_msg_none notifies that a multimedia component message was not recognized by the player player_msg_resolution_changed during adaptive streaming playback, notifies that the video resolution has changed player_msg_bitrate_change during adaptive streaming playback, notifies of a change, based on network heuristics, in the bandwidth-specific url the current bandwidth value is also sent player_sparse_track_detect during adaptive streaming playback, notifies that a sparse track was encountered player_streaming_event posts required streaming data player_msg_http_error_code describes the detailed http network situation information player_msg_drm_challenge_data for encrypted content playback, posts the drm challenge data player_msg_cue_tag_info during adaptive streaming playback, notifies that the video is having a cue event to indicate the discontinuity due to ad event data is also sent sample event data "cue_tag_info {cueout-> timestamp 18000, expected adduration 18000}{cuein-> timestamp 36000, actual adduration 18000}" remark 'player_msg_fragment_info' event has been deprecated from tizen version 2 4, because it affects the application performance 1 12 avplaystreaminfo defines a dictionary for streaming video, audio and subtitle information for various streaming scenarios dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; the following values are supported index unsigned long index type track type audio, video, or text extra_info domstring json string containing all media-related info such as height, width, and fourcc for a video stream, and bitrate, fourcc, language, and codec type for an audio stream 1 13 avplaysubtitleattribute defines a dictionary for subtitle attributes dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; the following values are supported attr_type attribute type domstring json start_pos start position stop_pos stop position 1 14 avplayvideoseamlessinfo defines a dictionary for auto rotate degree and scan_type of video playback information dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; the following values are supported scan_type scantype of the video value is 0 interlaced or 1 progressive rotation_degree auto rotate degree of the video value can be 0,90,180,270 1 15 avplayvideosize defines a dictionary for video size information dictionary avplayvideosize { unsigned long width; unsigned long height; }; since 10 0 the following values are supported width width video width in pixels height height video height in pixels 1 16 avplaycodecinfo defines a dictionary for codec information dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; since 10 0 the following values are supported audio_codec audio_codec audio codec string video_codec video_codec video codec string 2 interfaces 2 1 avplaymanagerobject defines a webapi object instance of the tizen samsung tv product api the webapis avplay object enables access to avplay api functionality [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; attributes readonly avplaymanager avplay avplay api namespace 2 2 avplaymanager provides methods for the avplay functionalities [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; avplayvideosize getvideosize ; avplaycodecinfo getcodecinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setseamlesslooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; methods open instantiates the player object with a content url as the input parameter void open domstring url ; product tv, av, b2b constraint can be called in the following states "none", "idle" parameters url content url for playback it can be an absolute local path or a remote url from a network-based stream server exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay open url ; } catch e { console log e } close destroys the player object void close ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay close ; } catch e { console log e } prepare prepares the media player for playback synchronously the player must already be created with a valid uri void prepare ; product tv, av, b2b constraint can be called in the following states "idle", "ready" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" with error type invalidaccesserror, if given url through open is valid, but not exist or not accessible due to network issue e g , webapis avplay open "http //abc" with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay prepare ; } catch e { console log e } prepareasync prepares the media player for playback asynchronously this method is preferred over prepare because it returns immediately and does not block the application thread during preparation when preparation is successful, the success callback is returned and the player is in ready state if preparation fails, the error callback returns the error value when prepareasync is used with "prebuffer_mode", successcallback is invoked when prebuffering is complete, instead of when preparation is complete void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle", "ready" parameters successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidaccesserror, if given url through open is valid, but not exist or network issue e g , webapis avplay open "http //abc" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay prepareasync successcallback, errorcallback ; setdisplayrect sets the display area for video content playback the 4 parameters specify the left side, top, window width, and window height based on a 1920 x 1080 resolution screen, regardless of the actual application resolution void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" when app is using normal calling sequence , open+setdisplay+prepare etc parameters x display area top-left x-coordinate must be less than the tv screen width y display area top-left y-coordinate must be less than the tv screen height width display area width must be less than the tv screen width height display area height must be less than the source image height exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains a negative value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setdisplayrect 0, 0, 1920, 1080 ; } catch e { console log e } getvideoseamlessinfo retrieves the video auto rotate degree and scan_type from demux side avplayvideoseamlessinfo getvideoseamlessinfo ; product b2b lfd constraint can be called in the following states "idle", "ready", "playing", "paused" return value avplayvideoseamlessinfo avplayvideoseamlessinfo current version remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details starting from 10 0, api is supported in tv and av exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 6 5 code example //getvideoseamlessinfo / getvideosize / getvideosize usage example //1 initialize players var currentplayer = webapis avplaystore getplayer ; // current video playback var nextplayer = webapis avplaystore getplayer ; // next video playback //2 prepare current player in prebuffer mode currentplayer open 'http //www example com/example_1 mp4' ; currentplayer setdisplayrect x, y, width, height ; currentplayer setstreamingproperty "prebuffer_mode", "0" ; currentplayer prepare ; //or prepareasync currentplayer play ; // get current video info during prebuffer var currentvideoinfo = currentplayer getvideoseamlessinfo ; var currentscantype = currentvideoinfo scan_type; var currentrotation = currentvideoinfo rotation_degree; // 3 prepare next player in prebuffer mode nextplayer open 'http //www example com/example_2 mp4' ; nextplayer setdisplayrect x, y, width, height ; nextplayer setstreamingproperty "prebuffer_mode", "0" ; nextplayer prepare ; //or prepareasync // get next video info during prebuffer var nextvideoinfo = nextplayer getvideoseamlessinfo ; var nextscantype = nextvideoinfo scan_type; var nextrotation = nextvideoinfo rotation_degree; // 4 check compatibility based on scan type and rotation // - getvideoseamlessinfo can be called in prebuffer state // - compare current video scan_type_1 and rotation_degree_1 // - with next video scan_type_2 and rotation_degree_2 //alternative info sources // - getvideosize can be used for resolution checks // - getcodecinfo can verify codec compatibility var iscompatible = currentscantype === nextscantype && currentrotation === nextrotation ; // 5 apply still mode if compatible before transition if iscompatible { currentplayer setvideostillmode "true" ; } nextplayer play ; currentplayer stop ; getvideosize retrieves the video size information from demux side avplayvideosize getvideosize ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing", "paused" parameters avplayvideosize containing width and height remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var videosizeinfo = webapis avplay getvideosize ; var width = videosizeinfo width; var height = videosizeinfo height; } catch e { console log e } getcodecinfo retrieves the codec information from demux side avplaycodecinfo getcodecinfo ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters avplaycodecinfo containing audio_codec and video_codec remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var codecinfo = webapis avplay getcodecinfo ; var audiocodec = codecinfo audio_codec; var videocodec = codecinfo video_codec; } catch e { console log e } play starts stream playback, or resumes stream playback after pause void play ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" remark adaptive streaming using ts container for e g hls with audio sample rate changing across variants may cause audio loss exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay play ; } catch e { console log e } seekto skips playback to a specific timestamp for http streaming, this method is successful even when the specified timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing" buffered data is flushed and buffering starts over , "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call for live stream case, seek position must be within dvr range dvr range could be retrieved using get_live_duration property in getstreamingproperty api parameters milliseconds timestamp to skip to successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example try { webapis avplay seekto 10000,successcallback, errorcallback ; } catch e { console log e } // for live cases, get the live duration as var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; // seekpoint must be between starttime and endtime stop stops the player call this function after the video finishes playing void stop ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay stop ; } catch e { console log e } getstate retrieves the current player state avplayplayerstate getstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var bret = webapis avplay getstate ; getsubstate retrieves the current player including preloading state avplayplayerstate getsubstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "preload", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle","preload", "ready", "playing", "paused" exceptions webapiexception with error type unknownerror, for any other error since 9 0 code example try { webapis avplay open 'http //www example com/example_1 mp4' ; webapis avplay setdisplayrect x, y, width, height ; webapis avplay prepare ; var bret = webapis avplay getsubstate ; // bret should be preload console log "getsubstate state ["+ bret+"]" ; webapis avplay play ; } catch e { console log "getsubstate error "+e ; } pause pauses playback if this method is called successfully, current time updates are stopped void pause ; product tv, av, b2b constraint can be called in the following states "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type invalidaccesserror, if this api couldn't operate at the moment e g during the async operation such as seekto, etc with error type unknownerror, for any other error code example try { webapis avplay pause ; } catch e { console log e } jumpforward skips playback forward by a specific amount of time the player state is unchanged passing the optional callbacks is recommended for best performance, ensure that the previous call to this api was successful for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip forward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpforward 5000,successcallback, errorcallback ; jumpbackward skips playback backward by a specific amount of time the player state is unchanged for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip backward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpbackward 5000,successcallback, errorcallback ; getduration retrieves the total media duration unsigned long getduration ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number duration, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example duration = calcplaytime webapis avplay getduration function calcplaytime totalmilisec { var hours = math floor totalmilisec/3600000 ; var minutes = math floor totalmilisec - hours3600000 / 60000 ; var seconds = math floor totalmilisec - hours3600000 - minutes60000 / 1000 ; var milisec = totalmilisec - hours3600000 - minutes60000 - seconds1000 ; return { hours hours, minutes minutes, seconds seconds, milisec milisec, totalmilisec totalmilisec } } getcurrenttime retrieves the current playback time unsigned long getcurrenttime ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number current playback time, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var currentplaytime = webapis avplay getcurrenttime ; settimeoutforbuffering sets the stream buffering timeout when the specified amount of time has passed, the onbufferingcomplete callback is invoked, irrespective of buffering progress if not set using this method, the default buffer size is 32mb or 10 seconds of playable data, and 20 seconds time-out void settimeoutforbuffering unsigned long seconds ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters seconds buffering timeout duration, in seconds depending on network conditions, 3 to 10 seconds is recommended exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay settimeoutforbuffering 10 ; setbufferingparam sets the buffer size for the play and resume scenarios the time buffer size must be at least 4 seconds for example, if a 10 second buffer size is set, playback can only start or resume after 10 seconds of media has accumulated in the buffer play scenarios include user-initiated streaming playback and whenever media playback is starting for the first time resume scenarios include resuming playback after pause or seek operations, or when lack of data causes playback rebuffering void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; product tv, av, b2b constraint can be called in the following states "idle" parameters option "player_buffer_for_play" or "player_buffer_for_resume" unit "player_buffer_size_in_second" or "player_buffer_size_in_byte" amount data amount to be buffered, in seconds as specified by the unit parameter remark unit "player_buffer_size_in_byte" has been deprecated from tizen version 5 0 since tizen version 6 0, if first parameter contains a value which is not in avplaybufferoption enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if second parameter contains a value which is not in avplaybuffersizeunit enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if third parameter contains a value which is not unsigned long, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example // for the initial buffering webapis avplay setbufferingparam "player_buffer_for_play","player_buffer_size_in_second", 5 ; // 5 is in seconds // for the rebuffering webapis avplay setbufferingparam "player_buffer_for_resume","player_buffer_size_in_second", 15 ; // 15 is in seconds setspeed sets the current playback rate positive parameter values play the media forwards, while negative values cause the media to play in reverse the range of valid playback rates depends on the streaming protocol if the input parameter is out of range, the player returns the player_error_invalid_parameter flag void setspeed long playbackspeed ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" for the general http and https, the supported playback rate is -8x ~ 8x repeated seek please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters playbackspeed -16x, -8x, -4x, -2x, 1x, 2x, 4x, 8x, 16x exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setspeed 2 ; } catch e { console log e } setlistener sets asynchronous callback methods for player information notifications, such as buffering progress, player information, playback mode, and drm mode information void setlistener avplayplaybackcallback playbackcallback ; product tv, av, b2b constraint can be called in the following states "none", "idle" recommended , "ready", "playing", "paused" to avoid missing necessary information, the onbufferingstart, onbufferingprogress, onbufferingcomplete, onerror, onerrormsg, onevent, and ondrmevent listeners must be set during the "idle" state parameters playbackcallback avplayplaybackcallback remark all callback functions are optional user can add only the methods for necessary notifications exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type unknownerror, for any other error code example var listener = { onbufferingstart function { console log "buffering start " ; }, onbufferingprogress function percent { console log "buffering progress data " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, oncurrentplaytime function currenttime { console log "current playtime " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, onevent function eventtype, eventdata { console log "event type error " + eventtype + ", data " + eventdata ; }, onerror function eventtype { console log "event type error " + eventtype ; }, onerrormsg function eventtype,eventmsg { console log "event type error " + eventtype ; console log "event message " + eventmsg ; }, onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; }, ondrmevent function drmevent, drmdata { console log "drm callback " + drmevent + ", data " + drmdata ; }, onstreamcompleted function { console log "stream completed" ; } } webapis avplay setlistener listener ; setdrm updates the drm information, such as setproperties you can change the drm mode and run the control feature the avplaydrmoperation and jsonparam parameters depend on the drm type please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications for the supported drm domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; product tv, av, b2b constraint can be called in the following states "idle" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"playready", "verimatrix", "widevine_cdm" } drmoperation avplaydrmoperation string specifying the drm operation to be performed the valid values are depending on the drm types this is mainly used for setting drm information, such as the license server, application-specific custom data, soap or http header, the genchallenge mode, and license usage jsonparam domstring drm parameter represented by json string you can use the json stringify method to generate the json string return value domstring drmstring remark 'verimatrix' drm not supported web client since tizen 7 0 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state, "none" with error type unknownerror, for any other error examples of exception scenarios include an invalid drm session, or failure to create the underlying drm module or configuration in these scenarios, an exception is thrown and the method call returns false code example // implementing drm support // 1 playready example setting license server and custom data // 1 1 playready with genchallenge supported since tizen 4 0 var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { // take drmdata challenge to obtain license data } } } webapis avplay setlistener listener ; var appdata={deletelicenseafteruse true,getchallenge true,licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // the avplay will configure and provide challenged data through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' webapis avplay setdrm "playready", "installlicense", license_data ; // 1 2 playready without genchallenge var appdata={deletelicenseafteruse true, licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // 2 verimatrix example initializing verimatrix drm // application should call getuid only once and save it for further use, after every open api getuid need not be called if true { // since tizen version 5 0 domstring verimatrix_uid = webapis avplay getuid "verimatrix" ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "getuid", "" ; } // after open application should follow following sequence var drmparam = {}; drmparam companyname ="mycompany"; drmparam iptv="public2 verimatrix com"; drmparam web="public-ott-nodrm verimatrix com 80"; if true { // since tizen version 5 0 webapis avplay setdrm "verimatrix", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "initialize", json stringify drmparam ; } // 3 widevine modular example var sessionid; var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { sessionid = drmdata session_id; // take drmdata challenge and drmdata serverurl to obtain license data } } } webapis avplay setlistener listener ; var drmparam = {}; // sample session value; app must set there own session id drmparam appsession = "test-session"; drmparam datatype = "mpeg-dash"; if true { // since tizen version 5 0 webapis avplay setdrm "widevine_cdm", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "widevine_cdm", "initialize", "" ; webapis avplay setdrm "widevine_cdm", "widevine_app_session", drmparam appsession ; webapis avplay setdrm "widevine_cdm", "widevine_data_type", drmparam datatype ; } // the avplay will configure and provide challenged data and session id through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' var licenseparam = sessionid + "param_start_position" + license_data + "param_start_position"; webapis avplay setdrm "widevine_cdm", "widevine_license_data", licenseparam ; //in tizen 5 0 onwards use eme_widevine_cdm instead of using widevine_cdm getuid gets the device uid the input would be the drm type domstring getuid avplaydrmtype drmtype ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"verimatrix"} // only verimatrix is supported avplaydrmtype for getuid interface return value domstring domstring remark since tizen version 6 0, if input contains a value which is not in avplaydrmtype enum, typemismatcherror is thrown instead of invalidvalueserror its deprecated because verimatrix not supported web client since tizen 7 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 7 0 code example var verimatrixuid = webapis avplay getuid "verimatrix" ; //verimatrix example retrieving the verimatrix uid setsoundanalysislistener retrieves the audio spectrum analysis result every 30 ms you can use it for an equalizer effect video or in a partytv application the spectrum is analyzed across an array of 31 bands, of which bands[14] ~ bands[18] generally have the largest values void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; product tv, av, b2b constraint can be called in the following states "idle" parameters soundanalysiscallback avplaysoundanalysiscallback exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay setsoundanalysislistener soundanalysislistener ; function soundanalysislistener dataarray { // listener registered to and receiving data from avplay var barheight = 0; var absvalue = 0; var threshold = 70; for var i = 0; i < dataarray length; i++ { absvalue = math abs dataarray[i] ; if absvalue > threshold { barheight = main barcontainerheight; } else { barheight = math round absvalue/threshold main barcontainerheight ; } if barheight == 0 barheight = 1; document getelementbyid 'frequencybar' + i style height = barheight + 'px'; } console log "sound analysis " + dataarray tostring ; } unsetsoundanalysislistener unregisters the sound analysis listener void unsetsoundanalysislistener ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay unsetsoundanalysislistener ; setsilentsubtitle enables or disables external subtitles void setsilentsubtitle boolean onoff ; product tv, av, b2b constraint can be called in the following states "idle", "ready" when using the synchronous prepare method , "playing", "paused" parameters onoff boolean value true subtitles are hidden false subtitles are shown the application does not receive any subtitle-related events exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsilentsubtitle true ; setexternalsubtitlepath sets the local path for the external subtitle file only absolute local paths are supported if the subtitle file is stored remotely, you must first download the file to local storage, and pass the absolute local path void setexternalsubtitlepath domstring filepath ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters filepath absolute local path exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setexternalsubtitlepath uri ; setsubtitleposition adjusts external subtitle synchronization with the audio and video void setsubtitleposition long position ; product tv, av, b2b constraint can be called in the following states "playing", "paused" parameters position time delay in milliseconds the duration can be a positive or negative number; a positive delay displays the subtitles later, while a negative delay displays the subtitles sooner exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsubtitleposition position_millisec ; setdisplaymethod sets the video screen mode in the specified display area void setdisplaymethod avplaydisplaymode displaymode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displaymode "player_display_mode_letter_box", "player_display_mode_full_screen", or "player_display_mode_auto_aspect_ratio" remark since tizen version 6 0, if input contains a value which is not in avplaydisplaymode enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setdisplaymethod "player_display_mode_full_screen" ; setselecttrack switches audio or subtitle tracks during playback void setselecttrack avplaystreamtype tracktype, long trackindex ; product tv, av, b2b constraint can be called in the following states "ready" for smooth streaming only , "playing", "paused" for text tracks only the tracktype "text" is not supported for dash streaming parameters tracktype "audio" or "text" trackindex avplaystreaminfo index remark since tizen version 6 0, if first parameter contains a value which is not in avplaystreamtype enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 5 0, the tracktype "audio" is supported for dash streaming exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var totaltrackinfo = webapis avplay gettotaltrackinfo ; for var i=0; i<totaltrackinfo length; i++ { if totaltrackinfo type == 'text' { console log 'find subtitle track ' ; console log 'subtitle track index is ' + totaltrackinfo index ; console log 'subtitle track language is ' + totaltrackinfo extra_info track_lang ; } } // choose subtitle track index 2 webapis avplay setselecttrack 'text',2 ; getcurrentstreaminfo retrieves the currently-playing video, audio, or subtitle stream information, and notifies that a stream is playing avplaystreaminfo[] getcurrentstreaminfo ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo array of objects containing tracktype, extrainfo and index for the current stream remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var streaminfo = webapis avplay getcurrentstreaminfo ; var text = ''; for var i = 0; i < streaminfo length; i++ { text += 'index ' + streaminfo[i] index + ''; text += 'type ' + streaminfo[i] type + ''; text += 'extra_info ' + streaminfo[i] extra_info + ''; } // all streams have extra_info as a jsonstring // video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" // audio extra_info example "{"language" "en","channels" "2","sample_rate" "44100","bit_rate" "96000","fourcc" "aacl"}" // text subtitle extra_info example "{"track_num" "0","track_lang" "en","subtitle_type" "-1","fourcc" "ttml"}" // if the stream is invalid, the domstring is null and the index value is -1 gettotaltrackinfo retrieves the currently-playing stream information avplaystreaminfo[] gettotaltrackinfo ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo[] structure containing tracktype, extrainfo and index of current stream returns information for the all available tracks in the stream the information is returned in the following structure for video tracks "{"fourcc" "%s","width" "%u","height" "%u","bit_rate" "%u"}" for audio track "{"language" "%s","channels" "%d","sample_rate" "%d","bit_rate" "%d","fourcc" "%s"}" for subtitle tracks "{"track_num" "%d","track_lang" "%s","subtitle_type" "%d","fourcc" "%s"}" some of them are not constant value e g video width, height, and bit_rate, audio channels, sample_rate, and bit_rate for adaptive streaming such as hls, dash and smoothstreaming remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var trackinfo = webapis avplay gettotaltrackinfo ; var text = 'type of track info ' + typeof trackinfo + ''; text += 'length ' + trackinfo length + ''; for var i = 0; i < trackinfo length; i++ { text += 'index ' + trackinfo[i] index + ''; text += 'type ' + trackinfo[i] type + ''; text += 'extra_info ' + trackinfo[i] extra_info + ''; } setstreamingproperty sets specific feature values for http, mms, or specific streaming engine smooth streaming, hls, dash, divx plus streaming, or widevine the available streaming properties depend on the streaming protocol or engine use the custom_message property for streaming engine or cp-specific settings void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; product tv, av, b2b constraint can be called in the following states "idle" parameters propertytype { "cookie", "user_agent", "prebuffer_mode" , "adaptive_info", "set_mode_4k", "property_hd_audio", "listen_sparse_track", "widevine", "use_videomixer", "set_mixedframe", "portrait_mode" , "in_app_multiview" }; propertyparam value according to the propertytype e g "adaptive_info" propetytypes are "bitrates", "startbitrate", "skipbitrate" "in_app_multiview" propetytypes are "video_view_resource_main" , "video_view_resource_sub" remark "use_videomixer", "set_mixedframe" are only for product b2b and available from tizen 2 4 onwards "portrait_mode" is only for product b2b and available from tizen 3 0 onwards "widevine" unit has been deprecated from tizen version 4 0 "property_hd_audio" unit has been deprecated from tizen version 2 4 since tizen version 6 0, if first paramter contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example //smooth streaming example var bitratestring = "bitrates=5000~10000|startbitrate=highest|skipbitrate=lowest"; webapis avplay setstreamingproperty "adaptive_info", bitratestring ; //prebuffer mode example //player1 => playback of main content //player2 => playback of advertisement buffered the ad content before playback player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open 'http //www example com/example_1 mp4' ; player1 setdisplayrect x, y, width, height ; player1 prepare ; player1 play ; player2 open 'http //www example com/example_2 mp4' ; player2 setstreamingproperty "prebuffer_mode", "5000" ; player2 setdisplayrect x, y, width, height ; player2 prepare ; player1 stop ; player2 play ; //user-agent example webapis avplay setstreamingproperty "useragent", "samsungsmooth-agent/1 1" ; setting resolution information for hls/dash webapis avplay setstreamingproperty "adaptive_info", "fixed_max_resolution=7680x4320" ; //mixer example player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open url1 ; player1 setstreamingproperty "use_videomixer", "" ; //enable video mixer player1 setdisplayrect 17, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player1 prepare ; player1 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player1 play ; player2 open url2 ; player2 setstreamingproperty "use_videomixer", "" ; //enable video mixer player2 setdisplayrect 973, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player2 prepare ; player2 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player2 play ; // 2 video simulatenous play example in_app_multiview player1 = webapis avplaystore getplayer player2 = webapis avplaystore getplayer ; //player1 => playback of main content //player2 => playback of sub content player1 open mainurl ; player1 setlistener listener1 ; player1 setdisplayrect 0, 0, 1920, 1080 ; //player1 setstreamingproperty 'in_app_multiview','video_view_resource_main' ; //by default it will use main video resource player1 prepare ; player1 play ; player2 open suburl ; player2 setlistener listener2 ; player2 setdisplayrect 700, 0, 600, 400 ; player2 disableaudiostream ; player2 setstreamingproperty 'in_app_multiview','video_view_resource_sub' ; player2 prepare ; player2 play ; getstreamingproperty retrieves a specific property value obtained by the streaming engine smooth streaming, hls, dash, or widevine domstring getstreamingproperty avplaystreamingpropertytype propertytype ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" parameters propertytype avplaystreamingpropertytype { "is_live", "available_bitrate", "get_live_duration","current_bandwidth"}; return value domstring domstring property value remark since tizen version 6 0, if input contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror get_server_time_scale and get_absolute_server_time supported for smooth streaming only exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var text = 'available_bitrate ' + webapis avplay getstreamingproperty "available_bitrate" ; text += 'current_bandwidth ' + webapis avplay getstreamingproperty "current_bandwidth" + ''; text += 'is_live ' + webapis avplay getstreamingproperty "is_live" +''; @code var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; if starttime > targetseektime { if endtime < targetseektime { webapis avplay seekto targetseektime ; //ms } } getversion retrieves the avplay version domstring getversion ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value domstring domstring string current version exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var version = webapis avplay getversion ; suspend pauses the player state when the application is sent to the background saves the current statistics for the ongoing playback session void suspend ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore ; } } ; setlooping this method sets the player's looping status if the looping status is true, playback automatically restarts upon finishing if it is false, it won't the default value of looping status is false void setlooping boolean islooping ; product b2b lfd constraint can be called in the following states "idle","ready", "playing", "paused" parameters islooping the new looping status where true means looping and false means non-looping exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setlooping true ; setseamlesslooping this method sets the player's seamless looping status playback automatically restarts upon finishing default is false supported for local files with specific container types mp4/mkv/avi/mov/ts/tp many functions such as seek, speed control, and subtitles are disabled or not working properly during seamless looping void setseamlesslooping ; product tv, av, b2b constraint can be called in the following states "idle" remark must be called before 'ready' state for local files streaming is not supported supported container types mp4, mkv, avi, mov, ts, tp disables seek, speed control, and subtitles during seamless looping the setting will be reset during stop/close calls for seamless playback in the next session, call setseamlesslooping again otherwise, playback will proceed as normal exceptions webapiexception with error type invalidvalueserror, if the feature is called with http url because it is not supported with streaming content with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example webapis avplay setseamlesslooping ; setvideostillmode this method sets video still mode still mode is for freezing last frame in display buffer void setvideostillmode domstring mode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters mode the still mode value where "true" sets video still mode and "false" turns off video still mode exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setvideostillmode "true" ; setdisplayrotation this method sets the rotation settings of the video surface display if no display is set, no operation is performed use this method to change the video orientation to portrait mode this api call will change the origin of coordinates so, application should call setdisplayrect again after calling this api void setdisplayrotation domstring displayrotation ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displayrotation the rotation of the display the valid values for display rotation are "player_display_rotation_none", "player_display_rotation_90", "player_display_rotation_180", "player_display_rotation_270" exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setdisplayrotation "player_display_rotation_90" ; restore during multitasking, restores the player state when the application is resumed for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore url, 0, false ; } } ; restoreasync during multitasking, restores the player state when the application is resumed restoreasync is an asynchronous interface other api, restore is a synchronous interface which blocks the application thread this method is preferred over restore because it returns immediately and does not block the application thread during its restoration when player is restored successful, the success callback is returned and player resumed the playback from the restored playback position, state, properties etc if restoration fails, the error callback returns the error value application is required to make further calls to avplay on its success or failure callback happens for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; try { var successcallback = function { console log "success" ; } var errorcallback = function err { throw new error 'error ' + err name ; } webapis avplay restoreasync url, 0, false, successcallback, errorcallback ; } catch e { console log e } } } ; enableaudiostream api to enable audio stream of a particular player instance out of current playing player instances this api disables audio stream of current active player instance and then enable audio for the player instance for which enableaudiostream has been called void enableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay enableaudiostream ; } catch e { console log e } disableaudiostream api to disable audio stream of a particular player instance out of current playing player instances void disableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay disableaudiostream ; } catch e { console log e } setvideoroi sets the roi region of interest area of the content video source void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; product b2b lfd constraint can be called in the following states "ready, "playing", "paused" please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters x_ratio coordinate ratio value of x to the max video source width size, valid range is 0 0~1 0 y_ratio coordinate ratio value of y to the max video source height size, valid range is 0 0~1 0 w_ratio width ratio value of the video source area based on the video width size, valid range is from greater than 0 0 to 1 0 h_ratio height ratio value of the video source area based on the video height size, valid range is from greater than 0 0 to 1 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error with error type notsupportederror, if this api is called from a tv device application since 6 0 code example try { webapis avplay setvideoroi 0,0,0 5,0 5 ; } catch e { console log e } ; 2 3 avplayplaybackcallback defines callbacks for buffering and playback notifications [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; void onresourceconflicted ; }; methods onbufferingstart callback method for asynchronous buffering started notifications void onbufferingstart ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingstart function { console log "buffering start " ; } onbufferingprogress callback method for asynchronous buffering progress notifications void onbufferingprogress unsigned long percent ; parameters percent unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingprogress function percent { console log "buffering progress data " + percent ; } onbufferingcomplete callback method for asynchronous buffering complete notifications void onbufferingcomplete ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingcomplete function { console log "buffering complete " ; } oncurrentplaytime callback method for the current playback time void oncurrentplaytime unsigned long currenttime ; parameters currenttime unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example oncurrentplaytime function currenttime { console log "current playtime " + currenttime ; } onstreamcompleted callback method for asynchronous playback finished notifications void onstreamcompleted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onstreamcompleted function { console log "stream completed" ; } onevent callback method for asynchronous event notifications void onevent avplayevent eventid, domstring data ; parameters eventid avplayevent object data domstring exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onevent function eventtype, eventdata { console log "onevent callback with eventtype " + eventtype ; } onerror callback method for avplay error notifications void onerror avplayerror eventid ; parameters eventid avplayerror object exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onerror function eventtype { console log "onerror event callback with eventtype " + eventtype ; } onerrormsg callback method for avplay detailed error message notifications void onerrormsg avplayerror eventid, domstring errormsg ; parameters eventid is of type avplayerror enum, which is defined above errormsg domstring json string containing all media-related info with respect to the error scenario exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 6 0 code example onerrormsg function eventtype, errormsg { console log "onerrormsg event callback with eventtype " + eventtype + "error message " + errormsg ; } //errormsg example "{"error_code" "player_error_connection_failed","url" "http //www xxxxx m3u8","downloadspeed" "10mb/s", // "http_request_header" "xxxxxxxx","http_response_header" "xxxxxxxx", "connect_error" {"curl" -23}}" //errormsg example " {"error_code" "player_error_not_supported_format","codec" "h264","demux" "mp4demux", // "resolution" "19201080","fps" "30", "detail_info" "decoder error"}" ondrmevent callback method for drm information notifications void ondrmevent avplaydrmtype type, drmdata data ; parameters type avplaydrmtype object data drmdata exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example ondrmevent function drmtype, drmdata { console log "drm callback, type " + drmtype + ", data " + drmdata ; if drmdata name === 'challenge' { var challengedata = { "name" drmdata name, "session_id" drmdata session_id, "challenge" drmdata challenge, "challenge_len" drmdata challenge_len, "serv_url" drmdata serverurl, "serv_url_len" drmdata serverurl_len } // use challenge data to get drm license } else if drmdata name === 'drmerror' { var errorinfo = { "name" drmdata name, "error_code" drmdata code, "error_message" drmdata message // generally, it's human readable message } } } onsubtitlechange callback method for asynchronous subtitle change notifications void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; parameters duration how long the subtitle data should show unsigned long value in milliseonds subtitles domstring the actual subtitle data it can be of type text of type image type domstring of unsigned int value a value of '0' means subtitle data is of type text and '1' means subtitle data is of type image attributes array of avplaysubtitleattribute "attr_type" "attributetype value"; "start_pos" start position as long; "stop_pos" stop position as long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; } onresourceconflicted callback method for resource conflict notifications void onresourceconflicted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 10 0 code example onresourceconflicted function { console log "resource conflicted " ; } 2 4 avplaysoundanalysiscallback this callback interface specifies subscriptions for any notification for sound analysis [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; deprecated 2 4 methods ongetexception required for error handling void ongetexception webapierror err ; parameters err webapierror deprecated 2 4 onsetexception set for the error handling void onsetexception webapierror err ; parameters err webapierror deprecated 2 4 ongetbandsarray provide the band array[32] having sound effect information void ongetbandsarray long[] band ; parameters band long band array[32] having sound effect information deprecated 2 4 3 full webidl module avplay { enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; enum scantype { "interlaced", "progressive" }; enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; enum avplaybuffersizeunit { "player_buffer_size_in_second" }; enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; enum avplaystreamtype { "video", "audio", "text" }; enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; dictionary avplayvideosize { unsigned long width; unsigned long height; }; dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; }; [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; };
Develop Smart Signage
apiavplay api to use samsung product api, <script type="text/javascript" src="$webapis/webapis/webapis js"></script> should be loaded in index html this module defines the multimedia player functionalities provided by the tizen samsung tv product api since 2 3 product tv, av, b2b summary of interfaces and methods interface method avplaymanagerobject avplaymanager void open domstring url ;void close ;void prepare ;void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ;void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ;avplayvideoseamlessinfo getvideoseamlessinfo ;avplayvideosize getvideosize ;avplaycodecinfo getcodecinfo ;void play ;void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void stop ;avplayplayerstate getstate ;avplayplayerstate getsubstate ;void pause ;void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ;unsigned long getduration ;unsigned long getcurrenttime ;void settimeoutforbuffering unsigned long seconds ;void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ;void setspeed long playbackspeed ;void setlistener avplayplaybackcallback playbackcallback ;domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ;domstring getuid avplaydrmtype drmtype ;void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ;void unsetsoundanalysislistener ;void setsilentsubtitle boolean onoff ;void setexternalsubtitlepath domstring filepath ;void setsubtitleposition long position ;void setdisplaymethod avplaydisplaymode displaymode ;void setselecttrack avplaystreamtype tracktype, long trackindex ;avplaystreaminfo[] getcurrentstreaminfo ;avplaystreaminfo[] gettotaltrackinfo ;void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ;domstring getstreamingproperty avplaystreamingpropertytype propertytype ;domstring getversion ;void suspend ;void setlooping boolean islooping ;void setseamlesslooping ;void setvideostillmode domstring mode ;void setdisplayrotation domstring displayrotation ;void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ;void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ;void enableaudiostream ;void disableaudiostream ;void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; avplayplaybackcallback void onbufferingstart ;void onbufferingprogress unsigned long percent ;void onbufferingcomplete ;void oncurrentplaytime unsigned long currenttime ;void onstreamcompleted ;void onevent avplayevent eventid, domstring data ;void onerror avplayerror eventid ;void onerrormsg avplayerror eventid, domstring errormsg ;void ondrmevent avplaydrmtype type, drmdata data ;void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ;void onresourceconflicted ; avplaysoundanalysiscallback void ongetexception webapierror err ;void onsetexception webapierror err ;void ongetbandsarray long[] band ; 1 type definitions 1 1 avplayplayerstate specifies the player state enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; the following values are supported none player is not created idle player is created but not prepared ready player is ready to play media playing player is playing media paused player is paused 1 2 scantype specifies the video scan type enum scantype { "interlaced", "progressive" }; the following values are supported interlaced video scanning type is interlaced progressive video scanning type is progressive 1 3 avplaydisplaymode specifies display modes enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; the following values are supported player_display_mode_letter_box letterbox mode player_display_mode_full_screen full-screen mode player_display_mode_auto_aspect_ratio screen mode based on video dar/par info 1 4 avplaybufferoption specifies buffering scenarios enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; the following values are supported player_buffer_for_play initial buffering scenario player_buffer_for_resume re-buffering which might be occured after initial buffering during the playback the onbufferingcomplete event would be triggered when the player_buffer_for_play amount of data is buffered the actual buffering completion time may vary depending on the contents format, bitrate, network speed and so on 1 5 avplaybuffersizeunit specifies buffer size units enum avplaybuffersizeunit { "player_buffer_size_in_second" }; the following values are supported player_buffer_size_in_second buffer size in seconds remark "player_buffer_size_in_byte" property has been deprecated from tizen version 5 0 1 6 avplaystreamingpropertytype specifies parameters for various streaming protocols, such as http, mms, and adaptive streaming smooth streaming, hls, and mpeg-dash enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; the following values are supported cookie http request cookie used to establish the session with the http server for setstreamingproperty user_agent http user agent, used in the http request header for setstreamingproperty prebuffer_mode property to initiate prebuffering mode the second parameter indicates start-time for prebuffered content, in milliseconds for setstreamingproperty adaptive_info sets a custom streaming url with various streaming parameters, such as "bitrates", "startbitrate", or "skipbitrate" for setstreamingproperty string containing custom attributes for adaptive streaming playback "startbitrate=" valid values are "lowest", "highest", and "average" you can also define a specific bandwidth for the start of playback "bitrates=" use '~' to define a bandwidth range 5000 ~ 20000 you can also define a specific bandwidth for playback "skipbitrate=" defines the bandwidth to use after a skip operation "startfragment=" for live content playback, defines the start fragment number "fixed_max_resolution=max_widthxmax_height" only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, application should use this attribute to complete the resolution information for the player set_mode_4k forces the player to use the 4k uhd decoder its parameter can be the string "true" or "false" for setstreamingproperty in the case of adaptive streaming which requires stream-change for different video resolution during the playback, only if the given media uri such as mpd in mpeg-dash or m3u8 in hls through open method doesn't describe entire required video resolutions, pass true with this property in idle state listen_sparse_track for the smooth streaming case, configures the player to listen for a "sparse name" configured through "propertyparam" the sparse track name is a string for setstreamingproperty is_live whether the stream is live or vod applicable to all streaming types for getstreamingproperty available_bitrate string listing the available bit-rates for the currently-playing stream for getstreamingproperty get_live_duration string describing the duration of live content for getstreamingproperty current_bandwidth string describing the current streaming bandwidth for getstreamingproperty use_videomixer property used for enabling/initializing video mixer feature on b2b product only for setstreamingproperty it should be set before setting set_mixedframe property on the player set_mixedframe property to set the position of mixed frame for setstreamingproperty setdisplayrect with required position on corresponding player instance to be called before setting this property portrait_mode property to force the playback the video in potrait mode on b2b proudct only for setstreamingproperty in_app_multiview property to select the scaler type, by default main scaler selected remark "in_app_multiview" is available since tizen version 7 0 "get_live_duration" is available since tizen version 2 4 "widevine" property has been deprecated from tizen version 4 0 "property_hd_audio" property has been deprecated from tizen version 2 4 "set_vr360_mode" property has been deprecated from tizen version 5 0 "set_mode_4k" property has been deprecated from tizen version 5 0 for retail tv property "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" has been available since 5 0 as an alternative "adaptive_info" with attribute "fixed_max_resolution=max_widthxmax_height" is available since tizen version 5 0 and api version 4 1 calling setstreamingproperty with set_mode_4k with parameter "true" is same as setting "adaptive_info" with attribute "fixed_max_resolution=3840x2160" 1 7 avplaydrmtype specifies drm systems supported by the player enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; the following values are supported playready playready verimatrix verimatrix widevine_cdm widevine modular 1 8 avplaydrmoperation specifies various drm operations enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; the following values are supported setproperties sets drm instance properties and initialize the drm instance for playready, verimatrix, and widevine cdm installlicense base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator initialize the playready drm instance widevine_license_data base64-encoded license data with given session id for widevine cdm an application shall retrieve license data using challenge data received in ondrmevent callback drm type drm operation json parameters value description playready setproperteis deletelicenseafteruse boolean true/false true delete the used license from tv storage after use false do not delete the used license from tv storage after use setproperties genchallenge boolean true/false true execute playready genchallenge case avplay will configure challenge data and provide challenge data through ondrmevent callback applications are responsible for communicating with license server and getting license after getting license, applications must perform “installlicense” drm operation via setdrm avplay api false execute playready getrights case in this case, playready will communicate with license server, get license and install license applications do not need to perform “installlicense” drmoperation setproperties cookie string set cookies setproperties customdata string set custom data setproperties licenseserver string set license server url for contents setproperties httpheader string set http header that the license server requires setproperties useragent string set user agent to be used setproperties soapheader string set soap header that the license server requires installlicense string set base64-encoded license data for playready an application shall retrieve license data using challenge data received in ondrmevent callback processinitiator this has been deprecated since 2019 initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 verimatrix setproperties companyname string set company name setproperties iptv string set license server url for iptv setproperties web string set license server url for webclient setproperties clienttype string set client type the value can be "web", "web-hls", "web-dash", or "iptv" verimatrix supports only “iptv”, “web” and “web-hls” initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 widevine cdm setproperties appsession string set session id string for the session established between an application and a server, earlier known as “widevine_app_session” setproperties datatype string set the data type such as "matroska_webm" or "mpeg-dash", earlier known as "widevine_data_type" widevine_license_data string set license data it accepts string type data that contains base64-encoded license data initialize this has been deprecated since 2019 finalize this has been deprecated since 2019 remark 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example 1 9 avplaystreamtype specifies stream types supported by the player enum avplaystreamtype { "video", "audio", "text" }; the following values are supported video video track audio audio track text subtitle track 1 10 avplayerror specifies the player error messages enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; the following values are supported player_error_none operation has successfully completed; no error player_error_invalid_parameter unable to find the parameter player_error_no_such_file unable to find the specified media content player_error_invalid_operation invalid api call at the moment player_error_seek_failed failed to perform seek operation, or seek operation called during an invalid state player_error_invalid_state avplay api method was called during an invalid state player_error_not_supported_file multimedia file type not supported player_error_not_supported_format multimedia file format not supported player_error_invalid_uri input uri is in an invalid format player_error_connection_failed failed multiple attempts to connect to the specified content server player_error_genereic failed to create the display window 1 11 avplayevent specifies player events enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; the following values are supported player_msg_none notifies that a multimedia component message was not recognized by the player player_msg_resolution_changed during adaptive streaming playback, notifies that the video resolution has changed player_msg_bitrate_change during adaptive streaming playback, notifies of a change, based on network heuristics, in the bandwidth-specific url the current bandwidth value is also sent player_sparse_track_detect during adaptive streaming playback, notifies that a sparse track was encountered player_streaming_event posts required streaming data player_msg_http_error_code describes the detailed http network situation information player_msg_drm_challenge_data for encrypted content playback, posts the drm challenge data player_msg_cue_tag_info during adaptive streaming playback, notifies that the video is having a cue event to indicate the discontinuity due to ad event data is also sent sample event data "cue_tag_info {cueout-> timestamp 18000, expected adduration 18000}{cuein-> timestamp 36000, actual adduration 18000}" remark 'player_msg_fragment_info' event has been deprecated from tizen version 2 4, because it affects the application performance 1 12 avplaystreaminfo defines a dictionary for streaming video, audio and subtitle information for various streaming scenarios dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; the following values are supported index unsigned long index type track type audio, video, or text extra_info domstring json string containing all media-related info such as height, width, and fourcc for a video stream, and bitrate, fourcc, language, and codec type for an audio stream 1 13 avplaysubtitleattribute defines a dictionary for subtitle attributes dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; the following values are supported attr_type attribute type domstring json start_pos start position stop_pos stop position 1 14 avplayvideoseamlessinfo defines a dictionary for auto rotate degree and scan_type of video playback information dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; the following values are supported scan_type scantype of the video value is 0 interlaced or 1 progressive rotation_degree auto rotate degree of the video value can be 0,90,180,270 1 15 avplayvideosize defines a dictionary for video size information dictionary avplayvideosize { unsigned long width; unsigned long height; }; since 10 0 the following values are supported width width video width in pixels height height video height in pixels 1 16 avplaycodecinfo defines a dictionary for codec information dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; since 10 0 the following values are supported audio_codec audio_codec audio codec string video_codec video_codec video codec string 2 interfaces 2 1 avplaymanagerobject defines a webapi object instance of the tizen samsung tv product api the webapis avplay object enables access to avplay api functionality [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; attributes readonly avplaymanager avplay avplay api namespace 2 2 avplaymanager provides methods for the avplay functionalities [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; avplayvideosize getvideosize ; avplaycodecinfo getcodecinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setseamlesslooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; methods open instantiates the player object with a content url as the input parameter void open domstring url ; product tv, av, b2b constraint can be called in the following states "none", "idle" parameters url content url for playback it can be an absolute local path or a remote url from a network-based stream server exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay open url ; } catch e { console log e } close destroys the player object void close ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay close ; } catch e { console log e } prepare prepares the media player for playback synchronously the player must already be created with a valid uri void prepare ; product tv, av, b2b constraint can be called in the following states "idle", "ready" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" with error type invalidaccesserror, if given url through open is valid, but not exist or not accessible due to network issue e g , webapis avplay open "http //abc" with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay prepare ; } catch e { console log e } prepareasync prepares the media player for playback asynchronously this method is preferred over prepare because it returns immediately and does not block the application thread during preparation when preparation is successful, the success callback is returned and the player is in ready state if preparation fails, the error callback returns the error value when prepareasync is used with "prebuffer_mode", successcallback is invoked when prebuffering is complete, instead of when preparation is complete void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle", "ready" parameters successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidaccesserror, if given url through open is valid, but not exist or network issue e g , webapis avplay open "http //abc" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay prepareasync successcallback, errorcallback ; setdisplayrect sets the display area for video content playback the 4 parameters specify the left side, top, window width, and window height based on a 1920 x 1080 resolution screen, regardless of the actual application resolution void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" when app is using normal calling sequence , open+setdisplay+prepare etc parameters x display area top-left x-coordinate must be less than the tv screen width y display area top-left y-coordinate must be less than the tv screen height width display area width must be less than the tv screen width height display area height must be less than the source image height exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains a negative value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setdisplayrect 0, 0, 1920, 1080 ; } catch e { console log e } getvideoseamlessinfo retrieves the video auto rotate degree and scan_type from demux side avplayvideoseamlessinfo getvideoseamlessinfo ; product b2b lfd constraint can be called in the following states "idle", "ready", "playing", "paused" return value avplayvideoseamlessinfo avplayvideoseamlessinfo current version remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details starting from 10 0, api is supported in tv and av exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 6 5 code example //getvideoseamlessinfo / getvideosize / getvideosize usage example //1 initialize players var currentplayer = webapis avplaystore getplayer ; // current video playback var nextplayer = webapis avplaystore getplayer ; // next video playback //2 prepare current player in prebuffer mode currentplayer open 'http //www example com/example_1 mp4' ; currentplayer setdisplayrect x, y, width, height ; currentplayer setstreamingproperty "prebuffer_mode", "0" ; currentplayer prepare ; //or prepareasync currentplayer play ; // get current video info during prebuffer var currentvideoinfo = currentplayer getvideoseamlessinfo ; var currentscantype = currentvideoinfo scan_type; var currentrotation = currentvideoinfo rotation_degree; // 3 prepare next player in prebuffer mode nextplayer open 'http //www example com/example_2 mp4' ; nextplayer setdisplayrect x, y, width, height ; nextplayer setstreamingproperty "prebuffer_mode", "0" ; nextplayer prepare ; //or prepareasync // get next video info during prebuffer var nextvideoinfo = nextplayer getvideoseamlessinfo ; var nextscantype = nextvideoinfo scan_type; var nextrotation = nextvideoinfo rotation_degree; // 4 check compatibility based on scan type and rotation // - getvideoseamlessinfo can be called in prebuffer state // - compare current video scan_type_1 and rotation_degree_1 // - with next video scan_type_2 and rotation_degree_2 //alternative info sources // - getvideosize can be used for resolution checks // - getcodecinfo can verify codec compatibility var iscompatible = currentscantype === nextscantype && currentrotation === nextrotation ; // 5 apply still mode if compatible before transition if iscompatible { currentplayer setvideostillmode "true" ; } nextplayer play ; currentplayer stop ; getvideosize retrieves the video size information from demux side avplayvideosize getvideosize ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing", "paused" parameters avplayvideosize containing width and height remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var videosizeinfo = webapis avplay getvideosize ; var width = videosizeinfo width; var height = videosizeinfo height; } catch e { console log e } getcodecinfo retrieves the codec information from demux side avplaycodecinfo getcodecinfo ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters avplaycodecinfo containing audio_codec and video_codec remark for tv this api is supported for local content only in idle state, this api is only usable during prebuffer mode see getvideoseamlessinfo code example for implementation details exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example try { var codecinfo = webapis avplay getcodecinfo ; var audiocodec = codecinfo audio_codec; var videocodec = codecinfo video_codec; } catch e { console log e } play starts stream playback, or resumes stream playback after pause void play ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" remark adaptive streaming using ts container for e g hls with audio sample rate changing across variants may cause audio loss exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay play ; } catch e { console log e } seekto skips playback to a specific timestamp for http streaming, this method is successful even when the specified timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "idle","ready", "playing" buffered data is flushed and buffering starts over , "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call for live stream case, seek position must be within dvr range dvr range could be retrieved using get_live_duration property in getstreamingproperty api parameters milliseconds timestamp to skip to successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example try { webapis avplay seekto 10000,successcallback, errorcallback ; } catch e { console log e } // for live cases, get the live duration as var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; // seekpoint must be between starttime and endtime stop stops the player call this function after the video finishes playing void stop ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example try { webapis avplay stop ; } catch e { console log e } getstate retrieves the current player state avplayplayerstate getstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var bret = webapis avplay getstate ; getsubstate retrieves the current player including preloading state avplayplayerstate getsubstate ; product tv, av, b2b constraint can be called in the following states "none", "idle", "preload", "ready", "playing", "paused" return value avplayplayerstate avplayplayerstate "none", "idle","preload", "ready", "playing", "paused" exceptions webapiexception with error type unknownerror, for any other error since 9 0 code example try { webapis avplay open 'http //www example com/example_1 mp4' ; webapis avplay setdisplayrect x, y, width, height ; webapis avplay prepare ; var bret = webapis avplay getsubstate ; // bret should be preload console log "getsubstate state ["+ bret+"]" ; webapis avplay play ; } catch e { console log "getsubstate error "+e ; } pause pauses playback if this method is called successfully, current time updates are stopped void pause ; product tv, av, b2b constraint can be called in the following states "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type invalidaccesserror, if this api couldn't operate at the moment e g during the async operation such as seekto, etc with error type unknownerror, for any other error code example try { webapis avplay pause ; } catch e { console log e } jumpforward skips playback forward by a specific amount of time the player state is unchanged passing the optional callbacks is recommended for best performance, ensure that the previous call to this api was successful for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip forward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpforward 5000,successcallback, errorcallback ; jumpbackward skips playback backward by a specific amount of time the player state is unchanged for http streaming, this method is successful even when the resulting timestamp is invalid the internal player automatically resets an out-of-range value to an in-range one void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" during this async operation, the other api would not be allowed so, the application needs to wait for one of both callbacks successcallback, errorcallback before any other api call parameters milliseconds time to skip backward, in milliseconds successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if given url through open is invalid e g , webapis avplay open "invalidurl" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type code example webapis avplay jumpbackward 5000,successcallback, errorcallback ; getduration retrieves the total media duration unsigned long getduration ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number duration, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example duration = calcplaytime webapis avplay getduration function calcplaytime totalmilisec { var hours = math floor totalmilisec/3600000 ; var minutes = math floor totalmilisec - hours3600000 / 60000 ; var seconds = math floor totalmilisec - hours3600000 - minutes60000 / 1000 ; var milisec = totalmilisec - hours3600000 - minutes60000 - seconds1000 ; return { hours hours, minutes minutes, seconds seconds, milisec milisec, totalmilisec totalmilisec } } getcurrenttime retrieves the current playback time unsigned long getcurrenttime ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long unsigned long number current playback time, in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var currentplaytime = webapis avplay getcurrenttime ; settimeoutforbuffering sets the stream buffering timeout when the specified amount of time has passed, the onbufferingcomplete callback is invoked, irrespective of buffering progress if not set using this method, the default buffer size is 32mb or 10 seconds of playable data, and 20 seconds time-out void settimeoutforbuffering unsigned long seconds ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters seconds buffering timeout duration, in seconds depending on network conditions, 3 to 10 seconds is recommended exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay settimeoutforbuffering 10 ; setbufferingparam sets the buffer size for the play and resume scenarios the time buffer size must be at least 4 seconds for example, if a 10 second buffer size is set, playback can only start or resume after 10 seconds of media has accumulated in the buffer play scenarios include user-initiated streaming playback and whenever media playback is starting for the first time resume scenarios include resuming playback after pause or seek operations, or when lack of data causes playback rebuffering void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; product tv, av, b2b constraint can be called in the following states "idle" parameters option "player_buffer_for_play" or "player_buffer_for_resume" unit "player_buffer_size_in_second" or "player_buffer_size_in_byte" amount data amount to be buffered, in seconds as specified by the unit parameter remark unit "player_buffer_size_in_byte" has been deprecated from tizen version 5 0 since tizen version 6 0, if first parameter contains a value which is not in avplaybufferoption enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if second parameter contains a value which is not in avplaybuffersizeunit enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 6 0, if third parameter contains a value which is not unsigned long, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example // for the initial buffering webapis avplay setbufferingparam "player_buffer_for_play","player_buffer_size_in_second", 5 ; // 5 is in seconds // for the rebuffering webapis avplay setbufferingparam "player_buffer_for_resume","player_buffer_size_in_second", 15 ; // 15 is in seconds setspeed sets the current playback rate positive parameter values play the media forwards, while negative values cause the media to play in reverse the range of valid playback rates depends on the streaming protocol if the input parameter is out of range, the player returns the player_error_invalid_parameter flag void setspeed long playbackspeed ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" for the general http and https, the supported playback rate is -8x ~ 8x repeated seek please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters playbackspeed -16x, -8x, -4x, -2x, 1x, 2x, 4x, 8x, 16x exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay setspeed 2 ; } catch e { console log e } setlistener sets asynchronous callback methods for player information notifications, such as buffering progress, player information, playback mode, and drm mode information void setlistener avplayplaybackcallback playbackcallback ; product tv, av, b2b constraint can be called in the following states "none", "idle" recommended , "ready", "playing", "paused" to avoid missing necessary information, the onbufferingstart, onbufferingprogress, onbufferingcomplete, onerror, onerrormsg, onevent, and ondrmevent listeners must be set during the "idle" state parameters playbackcallback avplayplaybackcallback remark all callback functions are optional user can add only the methods for necessary notifications exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type unknownerror, for any other error code example var listener = { onbufferingstart function { console log "buffering start " ; }, onbufferingprogress function percent { console log "buffering progress data " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, oncurrentplaytime function currenttime { console log "current playtime " + data1 ; }, onbufferingcomplete function { console log "buffering complete " ; }, onevent function eventtype, eventdata { console log "event type error " + eventtype + ", data " + eventdata ; }, onerror function eventtype { console log "event type error " + eventtype ; }, onerrormsg function eventtype,eventmsg { console log "event type error " + eventtype ; console log "event message " + eventmsg ; }, onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; }, ondrmevent function drmevent, drmdata { console log "drm callback " + drmevent + ", data " + drmdata ; }, onstreamcompleted function { console log "stream completed" ; } } webapis avplay setlistener listener ; setdrm updates the drm information, such as setproperties you can change the drm mode and run the control feature the avplaydrmoperation and jsonparam parameters depend on the drm type please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications for the supported drm domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; product tv, av, b2b constraint can be called in the following states "idle" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"playready", "verimatrix", "widevine_cdm" } drmoperation avplaydrmoperation string specifying the drm operation to be performed the valid values are depending on the drm types this is mainly used for setting drm information, such as the license server, application-specific custom data, soap or http header, the genchallenge mode, and license usage jsonparam domstring drm parameter represented by json string you can use the json stringify method to generate the json string return value domstring drmstring remark 'verimatrix' drm not supported web client since tizen 7 0 'getuid' operation has been deprecated from tizen version 5 0, rather application should use getuid api 'initialize' and 'finalize' operations have been deprecated from tizen version 5 0 because these are being executed by avplay itself 'widevine_app_session' and 'widevine_data_type' operations have been deprecated from tizen version 5 0 because these are merged into "setproperties" please refer to setdrm example exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state, "none" with error type unknownerror, for any other error examples of exception scenarios include an invalid drm session, or failure to create the underlying drm module or configuration in these scenarios, an exception is thrown and the method call returns false code example // implementing drm support // 1 playready example setting license server and custom data // 1 1 playready with genchallenge supported since tizen 4 0 var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { // take drmdata challenge to obtain license data } } } webapis avplay setlistener listener ; var appdata={deletelicenseafteruse true,getchallenge true,licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // the avplay will configure and provide challenged data through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' webapis avplay setdrm "playready", "installlicense", license_data ; // 1 2 playready without genchallenge var appdata={deletelicenseafteruse true, licenseserver "http //license company com", customdata "mycustom"}; webapis avplay setdrm "playready", "setproperties", json stringify appdata ; // 2 verimatrix example initializing verimatrix drm // application should call getuid only once and save it for further use, after every open api getuid need not be called if true { // since tizen version 5 0 domstring verimatrix_uid = webapis avplay getuid "verimatrix" ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "getuid", "" ; } // after open application should follow following sequence var drmparam = {}; drmparam companyname ="mycompany"; drmparam iptv="public2 verimatrix com"; drmparam web="public-ott-nodrm verimatrix com 80"; if true { // since tizen version 5 0 webapis avplay setdrm "verimatrix", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "verimatrix", "initialize", json stringify drmparam ; } // 3 widevine modular example var sessionid; var listener = { ondrmevent function drmtype, drmdata { if drmdata name === 'challenge' { sessionid = drmdata session_id; // take drmdata challenge and drmdata serverurl to obtain license data } } } webapis avplay setlistener listener ; var drmparam = {}; // sample session value; app must set there own session id drmparam appsession = "test-session"; drmparam datatype = "mpeg-dash"; if true { // since tizen version 5 0 webapis avplay setdrm "widevine_cdm", "setproperties", json stringify drmparam ; } else { // before tizen version 5 0 webapis avplay setdrm "widevine_cdm", "initialize", "" ; webapis avplay setdrm "widevine_cdm", "widevine_app_session", drmparam appsession ; webapis avplay setdrm "widevine_cdm", "widevine_data_type", drmparam datatype ; } // the avplay will configure and provide challenged data and session id through ondrmevent callback // once challenge data is received, the application should first decode challenge data using base64, and obtain license from the license server var license_data;// after obtaining license data, encode it using base64 and save into this 'license_data' var licenseparam = sessionid + "param_start_position" + license_data + "param_start_position"; webapis avplay setdrm "widevine_cdm", "widevine_license_data", licenseparam ; //in tizen 5 0 onwards use eme_widevine_cdm instead of using widevine_cdm getuid gets the device uid the input would be the drm type domstring getuid avplaydrmtype drmtype ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype avplaydrmtype {"verimatrix"} // only verimatrix is supported avplaydrmtype for getuid interface return value domstring domstring remark since tizen version 6 0, if input contains a value which is not in avplaydrmtype enum, typemismatcherror is thrown instead of invalidvalueserror its deprecated because verimatrix not supported web client since tizen 7 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 7 0 code example var verimatrixuid = webapis avplay getuid "verimatrix" ; //verimatrix example retrieving the verimatrix uid setsoundanalysislistener retrieves the audio spectrum analysis result every 30 ms you can use it for an equalizer effect video or in a partytv application the spectrum is analyzed across an array of 31 bands, of which bands[14] ~ bands[18] generally have the largest values void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; product tv, av, b2b constraint can be called in the following states "idle" parameters soundanalysiscallback avplaysoundanalysiscallback exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay setsoundanalysislistener soundanalysislistener ; function soundanalysislistener dataarray { // listener registered to and receiving data from avplay var barheight = 0; var absvalue = 0; var threshold = 70; for var i = 0; i < dataarray length; i++ { absvalue = math abs dataarray[i] ; if absvalue > threshold { barheight = main barcontainerheight; } else { barheight = math round absvalue/threshold main barcontainerheight ; } if barheight == 0 barheight = 1; document getelementbyid 'frequencybar' + i style height = barheight + 'px'; } console log "sound analysis " + dataarray tostring ; } unsetsoundanalysislistener unregisters the sound analysis listener void unsetsoundanalysislistener ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error deprecated 2 4 code example webapis avplay unsetsoundanalysislistener ; setsilentsubtitle enables or disables external subtitles void setsilentsubtitle boolean onoff ; product tv, av, b2b constraint can be called in the following states "idle", "ready" when using the synchronous prepare method , "playing", "paused" parameters onoff boolean value true subtitles are hidden false subtitles are shown the application does not receive any subtitle-related events exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsilentsubtitle true ; setexternalsubtitlepath sets the local path for the external subtitle file only absolute local paths are supported if the subtitle file is stored remotely, you must first download the file to local storage, and pass the absolute local path void setexternalsubtitlepath domstring filepath ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters filepath absolute local path exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setexternalsubtitlepath uri ; setsubtitleposition adjusts external subtitle synchronization with the audio and video void setsubtitleposition long position ; product tv, av, b2b constraint can be called in the following states "playing", "paused" parameters position time delay in milliseconds the duration can be a positive or negative number; a positive delay displays the subtitles later, while a negative delay displays the subtitles sooner exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setsubtitleposition position_millisec ; setdisplaymethod sets the video screen mode in the specified display area void setdisplaymethod avplaydisplaymode displaymode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displaymode "player_display_mode_letter_box", "player_display_mode_full_screen", or "player_display_mode_auto_aspect_ratio" remark since tizen version 6 0, if input contains a value which is not in avplaydisplaymode enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setdisplaymethod "player_display_mode_full_screen" ; setselecttrack switches audio or subtitle tracks during playback void setselecttrack avplaystreamtype tracktype, long trackindex ; product tv, av, b2b constraint can be called in the following states "ready" for smooth streaming only , "playing", "paused" for text tracks only the tracktype "text" is not supported for dash streaming parameters tracktype "audio" or "text" trackindex avplaystreaminfo index remark since tizen version 6 0, if first parameter contains a value which is not in avplaystreamtype enum, typemismatcherror is thrown instead of invalidvalueserror since tizen version 5 0, the tracktype "audio" is supported for dash streaming exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var totaltrackinfo = webapis avplay gettotaltrackinfo ; for var i=0; i<totaltrackinfo length; i++ { if totaltrackinfo type == 'text' { console log 'find subtitle track ' ; console log 'subtitle track index is ' + totaltrackinfo index ; console log 'subtitle track language is ' + totaltrackinfo extra_info track_lang ; } } // choose subtitle track index 2 webapis avplay setselecttrack 'text',2 ; getcurrentstreaminfo retrieves the currently-playing video, audio, or subtitle stream information, and notifies that a stream is playing avplaystreaminfo[] getcurrentstreaminfo ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo array of objects containing tracktype, extrainfo and index for the current stream remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var streaminfo = webapis avplay getcurrentstreaminfo ; var text = ''; for var i = 0; i < streaminfo length; i++ { text += 'index ' + streaminfo[i] index + ''; text += 'type ' + streaminfo[i] type + ''; text += 'extra_info ' + streaminfo[i] extra_info + ''; } // all streams have extra_info as a jsonstring // video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" // audio extra_info example "{"language" "en","channels" "2","sample_rate" "44100","bit_rate" "96000","fourcc" "aacl"}" // text subtitle extra_info example "{"track_num" "0","track_lang" "en","subtitle_type" "-1","fourcc" "ttml"}" // if the stream is invalid, the domstring is null and the index value is -1 gettotaltrackinfo retrieves the currently-playing stream information avplaystreaminfo[] gettotaltrackinfo ; product tv, av, b2b constraint can be called in the following states "ready" when using the synchronous prepare method , "playing", "paused" return value avplaystreaminfo[] avplaystreaminfo[] structure containing tracktype, extrainfo and index of current stream returns information for the all available tracks in the stream the information is returned in the following structure for video tracks "{"fourcc" "%s","width" "%u","height" "%u","bit_rate" "%u"}" for audio track "{"language" "%s","channels" "%d","sample_rate" "%d","bit_rate" "%d","fourcc" "%s"}" for subtitle tracks "{"track_num" "%d","track_lang" "%s","subtitle_type" "%d","fourcc" "%s"}" some of them are not constant value e g video width, height, and bit_rate, audio channels, sample_rate, and bit_rate for adaptive streaming such as hls, dash and smoothstreaming remark for the adaptive streaming such as hls, dash and smoothstreaming, the 'language' is same as what represented on given manifest file exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var trackinfo = webapis avplay gettotaltrackinfo ; var text = 'type of track info ' + typeof trackinfo + ''; text += 'length ' + trackinfo length + ''; for var i = 0; i < trackinfo length; i++ { text += 'index ' + trackinfo[i] index + ''; text += 'type ' + trackinfo[i] type + ''; text += 'extra_info ' + trackinfo[i] extra_info + ''; } setstreamingproperty sets specific feature values for http, mms, or specific streaming engine smooth streaming, hls, dash, divx plus streaming, or widevine the available streaming properties depend on the streaming protocol or engine use the custom_message property for streaming engine or cp-specific settings void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; product tv, av, b2b constraint can be called in the following states "idle" parameters propertytype { "cookie", "user_agent", "prebuffer_mode" , "adaptive_info", "set_mode_4k", "property_hd_audio", "listen_sparse_track", "widevine", "use_videomixer", "set_mixedframe", "portrait_mode" , "in_app_multiview" }; propertyparam value according to the propertytype e g "adaptive_info" propetytypes are "bitrates", "startbitrate", "skipbitrate" "in_app_multiview" propetytypes are "video_view_resource_main" , "video_view_resource_sub" remark "use_videomixer", "set_mixedframe" are only for product b2b and available from tizen 2 4 onwards "portrait_mode" is only for product b2b and available from tizen 3 0 onwards "widevine" unit has been deprecated from tizen version 4 0 "property_hd_audio" unit has been deprecated from tizen version 2 4 since tizen version 6 0, if first paramter contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example //smooth streaming example var bitratestring = "bitrates=5000~10000|startbitrate=highest|skipbitrate=lowest"; webapis avplay setstreamingproperty "adaptive_info", bitratestring ; //prebuffer mode example //player1 => playback of main content //player2 => playback of advertisement buffered the ad content before playback player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open 'http //www example com/example_1 mp4' ; player1 setdisplayrect x, y, width, height ; player1 prepare ; player1 play ; player2 open 'http //www example com/example_2 mp4' ; player2 setstreamingproperty "prebuffer_mode", "5000" ; player2 setdisplayrect x, y, width, height ; player2 prepare ; player1 stop ; player2 play ; //user-agent example webapis avplay setstreamingproperty "useragent", "samsungsmooth-agent/1 1" ; setting resolution information for hls/dash webapis avplay setstreamingproperty "adaptive_info", "fixed_max_resolution=7680x4320" ; //mixer example player1 = webapis avplaystore getplayer ; player2 = webapis avplaystore getplayer ; player1 open url1 ; player1 setstreamingproperty "use_videomixer", "" ; //enable video mixer player1 setdisplayrect 17, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player1 prepare ; player1 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player1 play ; player2 open url2 ; player2 setstreamingproperty "use_videomixer", "" ; //enable video mixer player2 setdisplayrect 973, 17, 932, 1044 ; //configure the position coordinates of this player instance, used for set_mixedframe player2 prepare ; player2 setstreamingproperty "set_mixedframe", "" ; //now sets position of mixed frame player2 play ; // 2 video simulatenous play example in_app_multiview player1 = webapis avplaystore getplayer player2 = webapis avplaystore getplayer ; //player1 => playback of main content //player2 => playback of sub content player1 open mainurl ; player1 setlistener listener1 ; player1 setdisplayrect 0, 0, 1920, 1080 ; //player1 setstreamingproperty 'in_app_multiview','video_view_resource_main' ; //by default it will use main video resource player1 prepare ; player1 play ; player2 open suburl ; player2 setlistener listener2 ; player2 setdisplayrect 700, 0, 600, 400 ; player2 disableaudiostream ; player2 setstreamingproperty 'in_app_multiview','video_view_resource_sub' ; player2 prepare ; player2 play ; getstreamingproperty retrieves a specific property value obtained by the streaming engine smooth streaming, hls, dash, or widevine domstring getstreamingproperty avplaystreamingpropertytype propertytype ; product tv, av, b2b constraint can be called in the following states "ready", "playing", "paused" parameters propertytype avplaystreamingpropertytype { "is_live", "available_bitrate", "get_live_duration","current_bandwidth"}; return value domstring domstring property value remark since tizen version 6 0, if input contains a value which is not in avplaystreamingpropertytype enum, typemismatcherror is thrown instead of invalidvalueserror get_server_time_scale and get_absolute_server_time supported for smooth streaming only exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example var text = 'available_bitrate ' + webapis avplay getstreamingproperty "available_bitrate" ; text += 'current_bandwidth ' + webapis avplay getstreamingproperty "current_bandwidth" + ''; text += 'is_live ' + webapis avplay getstreamingproperty "is_live" +''; @code var starttime = webapis avplay getstreamingproperty "get_live_duration" split '|' [0]; var endtime = webapis avplay getstreamingproperty "get_live_duration" split '|' [1]; if starttime > targetseektime { if endtime < targetseektime { webapis avplay seekto targetseektime ; //ms } } getversion retrieves the avplay version domstring getversion ; product tv, av, b2b constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value domstring domstring string current version exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example var version = webapis avplay getversion ; suspend pauses the player state when the application is sent to the background saves the current statistics for the ongoing playback session void suspend ; product tv, av, b2b constraint can be called in the following states "ready, "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore ; } } ; setlooping this method sets the player's looping status if the looping status is true, playback automatically restarts upon finishing if it is false, it won't the default value of looping status is false void setlooping boolean islooping ; product b2b lfd constraint can be called in the following states "idle","ready", "playing", "paused" parameters islooping the new looping status where true means looping and false means non-looping exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setlooping true ; setseamlesslooping this method sets the player's seamless looping status playback automatically restarts upon finishing default is false supported for local files with specific container types mp4/mkv/avi/mov/ts/tp many functions such as seek, speed control, and subtitles are disabled or not working properly during seamless looping void setseamlesslooping ; product tv, av, b2b constraint can be called in the following states "idle" remark must be called before 'ready' state for local files streaming is not supported supported container types mp4, mkv, avi, mov, ts, tp disables seek, speed control, and subtitles during seamless looping the setting will be reset during stop/close calls for seamless playback in the next session, call setseamlesslooping again otherwise, playback will proceed as normal exceptions webapiexception with error type invalidvalueserror, if the feature is called with http url because it is not supported with streaming content with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 10 0 code example webapis avplay setseamlesslooping ; setvideostillmode this method sets video still mode still mode is for freezing last frame in display buffer void setvideostillmode domstring mode ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters mode the still mode value where "true" sets video still mode and "false" turns off video still mode exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setvideostillmode "true" ; setdisplayrotation this method sets the rotation settings of the video surface display if no display is set, no operation is performed use this method to change the video orientation to portrait mode this api call will change the origin of coordinates so, application should call setdisplayrect again after calling this api void setdisplayrotation domstring displayrotation ; product tv, av, b2b constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displayrotation the rotation of the display the valid values for display rotation are "player_display_rotation_none", "player_display_rotation_90", "player_display_rotation_180", "player_display_rotation_270" exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error since 4 0 code example webapis avplay setdisplayrotation "player_display_rotation_90" ; restore during multitasking, restores the player state when the application is resumed for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; webapis avplay restore url, 0, false ; } } ; restoreasync during multitasking, restores the player state when the application is resumed restoreasync is an asynchronous interface other api, restore is a synchronous interface which blocks the application thread this method is preferred over restore because it returns immediately and does not block the application thread during its restoration when player is restored successful, the success callback is returned and player resumed the playback from the restored playback position, state, properties etc if restoration fails, the error callback returns the error value application is required to make further calls to avplay on its success or failure callback happens for live streaming or drm-encrypted content playback, you must check whether the streaming url has changed or the drm session or license has expired, and specify the new url and drm information as needed void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; product tv, av, b2b constraint can be called in the following states "none", "playing", "paused" parameters url [optional][nullable] optional updated url after suspend if null, the stored url is used for live streaming or drm-encrypted content playback, in case the url has changed or the drm license or session has expired, checking for and passing the newest url is recommended resumetime [optional][nullable] milliseconds optional position from which to resume playback if 0, the stored position is used for live streaming, this parameter is not meaningful do not pass 0 for this parameter for drm-encrypted content playback, if the drm session has expired, to recreate the playback pipeline, pass 0 for this parameter bprepare [optional][nullable] optional boolean false default player sets the resume behavior automatically true player does not resume automatically the application must invoke the prepare and play methods for live streaming, this parameter is not meaningful do not pass true for this parameter for drm-encrypted content playback if the drm session has expired, pass true for this parameter successcallback [optional][nullable] callback method to invoke when the call is successful errorcallback [optional][nullable] callback method to invoke when an error occurs exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example document addeventlistener "visibilitychange", function { if document hidden { // something you want to do when application is paused console log "lifecycle [pause]" ; webapis avplay suspend ; } else { // something you want to do when application is resumed console log "lifecycle [resume]" ; try { var successcallback = function { console log "success" ; } var errorcallback = function err { throw new error 'error ' + err name ; } webapis avplay restoreasync url, 0, false, successcallback, errorcallback ; } catch e { console log e } } } ; enableaudiostream api to enable audio stream of a particular player instance out of current playing player instances this api disables audio stream of current active player instance and then enable audio for the player instance for which enableaudiostream has been called void enableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay enableaudiostream ; } catch e { console log e } disableaudiostream api to disable audio stream of a particular player instance out of current playing player instances void disableaudiostream ; product tv,av,b2b constraint can be called in the following states "idle", "ready", "playing", "paused" remark if application calls this api for a particular instance then its application responsibility to take care of for enable/disable audio stream using respective api's when required this api is available in tv since tizen 6 5 exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example try { webapis avplay disableaudiostream ; } catch e { console log e } setvideoroi sets the roi region of interest area of the content video source void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; product b2b lfd constraint can be called in the following states "ready, "playing", "paused" please refer to the specification https //developer samsung com/tv/develop/specifications/general-specifications/#streaming-feature-support for the supported range of other streaming types parameters x_ratio coordinate ratio value of x to the max video source width size, valid range is 0 0~1 0 y_ratio coordinate ratio value of y to the max video source height size, valid range is 0 0~1 0 w_ratio width ratio value of the video source area based on the video width size, valid range is from greater than 0 0 to 1 0 h_ratio height ratio value of the video source area based on the video height size, valid range is from greater than 0 0 to 1 0 exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with its expected type with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error with error type notsupportederror, if this api is called from a tv device application since 6 0 code example try { webapis avplay setvideoroi 0,0,0 5,0 5 ; } catch e { console log e } ; 2 3 avplayplaybackcallback defines callbacks for buffering and playback notifications [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; void onresourceconflicted ; }; methods onbufferingstart callback method for asynchronous buffering started notifications void onbufferingstart ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingstart function { console log "buffering start " ; } onbufferingprogress callback method for asynchronous buffering progress notifications void onbufferingprogress unsigned long percent ; parameters percent unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingprogress function percent { console log "buffering progress data " + percent ; } onbufferingcomplete callback method for asynchronous buffering complete notifications void onbufferingcomplete ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onbufferingcomplete function { console log "buffering complete " ; } oncurrentplaytime callback method for the current playback time void oncurrentplaytime unsigned long currenttime ; parameters currenttime unsigned long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example oncurrentplaytime function currenttime { console log "current playtime " + currenttime ; } onstreamcompleted callback method for asynchronous playback finished notifications void onstreamcompleted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onstreamcompleted function { console log "stream completed" ; } onevent callback method for asynchronous event notifications void onevent avplayevent eventid, domstring data ; parameters eventid avplayevent object data domstring exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onevent function eventtype, eventdata { console log "onevent callback with eventtype " + eventtype ; } onerror callback method for avplay error notifications void onerror avplayerror eventid ; parameters eventid avplayerror object exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onerror function eventtype { console log "onerror event callback with eventtype " + eventtype ; } onerrormsg callback method for avplay detailed error message notifications void onerrormsg avplayerror eventid, domstring errormsg ; parameters eventid is of type avplayerror enum, which is defined above errormsg domstring json string containing all media-related info with respect to the error scenario exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 6 0 code example onerrormsg function eventtype, errormsg { console log "onerrormsg event callback with eventtype " + eventtype + "error message " + errormsg ; } //errormsg example "{"error_code" "player_error_connection_failed","url" "http //www xxxxx m3u8","downloadspeed" "10mb/s", // "http_request_header" "xxxxxxxx","http_response_header" "xxxxxxxx", "connect_error" {"curl" -23}}" //errormsg example " {"error_code" "player_error_not_supported_format","codec" "h264","demux" "mp4demux", // "resolution" "19201080","fps" "30", "detail_info" "decoder error"}" ondrmevent callback method for drm information notifications void ondrmevent avplaydrmtype type, drmdata data ; parameters type avplaydrmtype object data drmdata exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example ondrmevent function drmtype, drmdata { console log "drm callback, type " + drmtype + ", data " + drmdata ; if drmdata name === 'challenge' { var challengedata = { "name" drmdata name, "session_id" drmdata session_id, "challenge" drmdata challenge, "challenge_len" drmdata challenge_len, "serv_url" drmdata serverurl, "serv_url_len" drmdata serverurl_len } // use challenge data to get drm license } else if drmdata name === 'drmerror' { var errorinfo = { "name" drmdata name, "error_code" drmdata code, "error_message" drmdata message // generally, it's human readable message } } } onsubtitlechange callback method for asynchronous subtitle change notifications void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; parameters duration how long the subtitle data should show unsigned long value in milliseonds subtitles domstring the actual subtitle data it can be of type text of type image type domstring of unsigned int value a value of '0' means subtitle data is of type text and '1' means subtitle data is of type image attributes array of avplaysubtitleattribute "attr_type" "attributetype value"; "start_pos" start position as long; "stop_pos" stop position as long exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error code example onsubtitlechange function duration, text, data3, data4 { console log "subtitle changed " ; } onresourceconflicted callback method for resource conflict notifications void onresourceconflicted ; exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror, for any other error since 10 0 code example onresourceconflicted function { console log "resource conflicted " ; } 2 4 avplaysoundanalysiscallback this callback interface specifies subscriptions for any notification for sound analysis [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; deprecated 2 4 methods ongetexception required for error handling void ongetexception webapierror err ; parameters err webapierror deprecated 2 4 onsetexception set for the error handling void onsetexception webapierror err ; parameters err webapierror deprecated 2 4 ongetbandsarray provide the band array[32] having sound effect information void ongetbandsarray long[] band ; parameters band long band array[32] having sound effect information deprecated 2 4 3 full webidl module avplay { enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; enum scantype { "interlaced", "progressive" }; enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; enum avplaybufferoption { "player_buffer_for_play", "player_buffer_for_resume" }; enum avplaybuffersizeunit { "player_buffer_size_in_second" }; enum avplaystreamingpropertytype { "cookie", "user_agent", "prebuffer_mode", "adaptive_info", "set_mode_4k", "listen_sparse_track", "is_live", "available_bitrate", "get_live_duration", "current_bandwidth", "use_videomixer", "set_mixedframe", "portrait_mode", "in_app_multiview" }; enum avplaydrmtype { "playready", "verimatrix", "widevine_cdm" }; enum avplaydrmoperation { "setproperties", "installlicense", "processinitiator", "widevine_license_data" }; enum avplaystreamtype { "video", "audio", "text" }; enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_no_such_file", "player_error_invalid_operation", "player_error_seek_failed", "player_error_invalid_state", "player_error_not_supported_file", "player_error_not_supported_format", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; enum avplayevent { "player_msg_none", "player_msg_resolution_changed", "player_msg_bitrate_change", "player_sparse_track_detect", "player_streaming_event", "player_msg_http_error_code", "player_msg_drm_challenge_data", "player_msg_cue_tag_info" }; dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; dictionary avplaysubtitleattribute { domstring attr_type; long start_pos; long stop_pos; }; dictionary avplayvideoseamlessinfo { scantype scan_type; double rotation_degree; }; dictionary avplayvideosize { unsigned long width; unsigned long height; }; dictionary avplaycodecinfo { domstring audio_codec; domstring video_codec; }; [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; avplayvideoseamlessinfo getvideoseamlessinfo ; void play ; void seekto long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void stop ; avplayplayerstate getstate ; void pause ; void jumpforward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; void jumpbackward long milliseconds, optional successcallback? successcallback, optional errorcallback? errorcallback ; unsigned long getduration ; unsigned long getcurrenttime ; void settimeoutforbuffering unsigned long seconds ; void setbufferingparam avplaybufferoption option, avplaybuffersizeunit unit, unsigned long amount ; void setspeed long playbackspeed ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; domstring getuid avplaydrmtype drmtype ; void setsoundanalysislistener avplaysoundanalysiscallback soundanalysiscallback ; void unsetsoundanalysislistener ; void setsilentsubtitle boolean onoff ; void setexternalsubtitlepath domstring filepath ; void setsubtitleposition long position ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo[] getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, domstring propertyparam ; domstring getstreamingproperty avplaystreamingpropertytype propertytype ; domstring getversion ; void suspend ; void setlooping boolean islooping ; void setvideostillmode domstring mode ; void setdisplayrotation domstring displayrotation ; void restore optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare ; void restoreasync optional domstring? url, optional unsigned long? resumetime, optional boolean? bprepare, optional successcallback? successcallback, optional errorcallback? errorcallback ; void enableaudiostream ; void disableaudiostream ; void setvideoroi double x_ratio, double y_ratio, double w_ratio, double h_ratio ; }; [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onbufferingstart ; void onbufferingprogress unsigned long percent ; void onbufferingcomplete ; void oncurrentplaytime unsigned long currenttime ; void onstreamcompleted ; void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void onerrormsg avplayerror eventid, domstring errormsg ; void ondrmevent avplaydrmtype type, drmdata data ; void onsubtitlechange domstring duration, domstring subtitles, domstring type, avplaysubtitleattribute[] attributes ; }; [callback=functiononly, nointerfaceobject] interface avplaysoundanalysiscallback { void ongetexception webapierror err ; void onsetexception webapierror err ; void ongetbandsarray long[] band ; }; };
Develop Smart TV
docsamsung checkout this topic describes how you can develop a billing system for your application, to allow users to make purchases within your application related info billing api productinfo api sso api samsung checkout dpi portal guide samsung checkout for tizen net samsung checkout dpi portal samsung checkout on tv samples samsung checkout web application samsung checkout net application samsung checkout offers an optimized purchase experience for your users on samsung tvs the user can quickly and safely register a payment method and make frictionless payments repeatedly within the tv environment in addition, samsung checkout provides a comprehensive global monetization platform, which allows you to integrate various business models and promotional campaigns into your services the tv-optimized purchase experience provides the user a quick and simple 3-step checkout, once a payment method is registered the checkout requires only number-centric information to be entered, making it easy to use with a tv remote control users can register their payment method directly on the tv or through a mobile phone to use samsung checkout, the user needs tv samsung smart tv, 2016 or later model supporting tizen excluding evolution kit payment method credit or debit card, paypal, or samsung pay in korea, united states security tizen secureime, 2nd-screen card registration mobile or pc account samsung account for sharing account and payment information with galaxy phones importanta samsung account is mandatory for using samsung checkout samsung checkout assumes that the user is logged in to samsung account at all times samsung checkout provides one solution for payment execution ✔ one solution supports all functions from payment operation ✔ operate automatically settlement and payout strong security payment solution ✔ acquire pci-dss certification and follow regulation each of countries psd2 ✔ following psd2 regulantion and gdpr deliver the coupon/promotional code in various ways of distribution with easiest ux ✔ issue coupons for promotion provide dpi digital product inventory system ✔ create and manage service items ✔ check the status of sales amounts and transaction scale ✔ refund and cancel subscription you can manage your product application and product sales through the dpi digital product inventory and process the actual purchase through samsung checkout importantall application data that is saved locally on a tv is deleted when the application is deleted from that tv if the user's purchase history is saved only in the tv storage and not remotely, and the user deletes and reinstalls the application, all application settings and content are removed, including purchased content if your application saves purchase information in the tv storage only, inform the user that uninstalling the application deletes their purchased content the dpi portal provides functions, such as "purchase history unapply" and "refund", to help you address situations when your customer inadvertently deletes application data before proceeding with the unapply and refund processes, you must contact a samsung representative by going to "samsung apps tv seller office > support" and creating a "1 1 q&a" support ticket samsung checkout purchase process when a user wants to purchase a product on your application, samsung checkout provides a common purchase gui, which identifies the user and confirms first the purchase and then the purchase completion after the user completes the purchase, samsung checkout returns the purchase result to your application product, purchase, and payment management the following figure illustrates how you can use samsung checkout and the information in the dpi server to manage in-app purchases and payments in your application request the purchase list retrieve the customer purchase list using a purchase list api request respond to the purchase list content if there are products in the purchase list which are not applied, verify the purchase and apply the products if there are products in the purchase list which have been refunded, retrieve the products send the application result to the server request the product list request the product information list using a products list api request the user purchases the product when the user selects “buy” in the application, provide a common purchase gui through samsung checkout the user can enter a voucher or coupon code to modify the purchase price the user confirms the purchase by entering a pin on the common purchase gui, or biometric information on samsung pay samsung checkout delivers the purchase result to your application request the purchase list update the customer purchase list verify the purchase verify the purchase using a verify purchase api request apply the product apply the product using an apply product api request, and send the application result to the server payment flow with dynamic products if a partner already has a cms server which manages products and prices, and frequent changes to product information are required, the partner and samsung can discuss the use of dynamic products when they integrate samsung checkout if they agree on that products and prices will be managed by the partner's own cms instead of samsung’s dpi, the partner needs to register a representative item on the dpi so that the samsung checkout system can display legally-required information on samsung smart tv app/game store however, the partner does not need to register each product on the dpi that they sell in their application they should build and operate their own cms to manage product information, including prices, and provide the rest of the api for verification of purchase requests the following figure shows the data flow of the initialization stage in a payment process with dynamic products additional dpi requirements as this model requires the partner's cms to manage product information, there are additional requirements that partner need to fulfill for dpi settings verification/no verification ‘verification’ is a recommended option, otherwise the partner has to handle the verification process themselves and accept the responsibility for all error cases related to the verification process if the ‘verification’ option is selected, ‘verify uri’ is also required this uri needs serve the function of checking product information such as the product itself, price, and currency during the initialization sequence of the payment process price setting the price range information of products that you actually sell in your application is required by country this information is not used for actual payment, but for providing legally-required application information on the samsung smart tv app/game store which therefore, it has to be updated when the price range of your products is changed differences when using dynamic products during buyitem , when using dynamic products the partner needs to set the following values in order to complete the payment process "orderitemid" - representative productid that is registered to dpi portal as a dynamic product type "ordertitle" - customized name for each purchase displayed as in figure 7 "ordertotal" - customized price for each purchase displayed as in figure 7 "dynmcproductid" - unique product id managed by the partner cms in addition, during verify product, the partner needs to strictly verify the following values in order to identify if the product information is appropriate "appid" - the application has to be appropriate for this payment process "productid" - the product id has to match the representative productid from the dpi portal "productprice" - the price of the product that partner intended to sell to user "dynmcproductid" - the product id is an appropriate id that is being handled by the partner cms checkout service county/location list no area country eng business model 1 north america canada agent 2 north america united states commissionaire 3 europe aland islands commissionaire 4 europe albania agent 5 europe austria commissionaire 6 europe belgium commissionaire 7 europe bosnia and herzegovina agent 8 europe bulgaria commissionaire 9 europe croatia commissionaire 10 europe cyprus commissionaire 11 europe czech republic commissionaire 12 europe denmark commissionaire 13 europe estonia commissionaire 14 europe faroe islands commissionaire 15 europe finland commissionaire 16 europe france commissionaire 17 europe germany commissionaire 18 europe greece commissionaire 19 europe greenland commissionaire 20 europe guernsey commissionaire 21 europe hungary commissionaire 22 europe iceland agent 23 europe ireland commissionaire 24 europe isle of man commissionaire 25 europe italy commissionaire 26 europe jersey commissionaire 27 europe latvia commissionaire 28 europe lithuania commissionaire 29 europe luxembourg commissionaire 30 europe montenegro agent 31 europe netherlands commissionaire 32 europe north macedonia agent 33 europe norway commissionaire 34 europe poland commissionaire 35 europe portugal commissionaire 36 europe romania commissionaire 37 europe serbia agent 38 europe slovakia commissionaire 39 europe slovenia commissionaire 40 europe spain commissionaire 41 europe sweden commissionaire 42 europe switzerland agent 43 europe united kingdom commissionaire 44 asia australia agent 45 asia hong kong agent 46 asia india agent 47 asia indonesia agent 48 asia korea, republic of agent 49 asia malaysia agent 50 asia new zealand agent 51 asia philippines agent 52 asia singapore agent 53 asia taiwan agent 54 asia thailand agent 55 asia vietnam agent 56 cis belarus agent 57 cis kazakhstan agent 58 cis kyrgyzstan agent 59 cis moldova agent 60 cis mongolia agent 61 cis russian federation agent 62 cis tajikistan agent 63 cis turkmenistan agent 64 cis ukraine agent 65 cis uzbekistan agent 66 latam argentina agent 67 latam bolivia agent 68 latam brazil agent 69 latam chile agent 70 latam colombia agent 71 latam costa rica agent 72 latam dominican republic agent 73 latam ecuador agent 74 latam guatemala agent 75 latam mexico agent 76 latam panama agent 77 latam peru agent 78 latam venezuela agent 79 mena algeria agent 80 mena bahrain agent 81 mena egypt agent 82 mena ghana agent 83 mena iraq agent 84 mena israel agent 85 mena jordan agent 86 mena kenya agent 87 mena kuwait agent 88 mena lebanon agent 89 mena libya agent 90 mena mauritius agent 91 mena morocco agent 92 mena nigeria agent 93 mena oman agent 94 mena pakistan agent 95 mena qatar agent 96 mena saudi arabia agent 97 mena south africa agent 98 mena tunisia agent 99 mena türkiye agent 100 mena united arab emirates agent 101 mena yemen agent 102 latam paraguay agent 103 latam uruguay agent 104 latam el salvador agent 105 latam honduras agent 106 latam nicaragua agent 107 latam bahamas agent 108 latam jamaica agent 109 latam trinidad & tobago agent 110 asia cambodia agent 111 asia myanmar agent 112 asia laos agent 113 asia macao agent 114 asia bangladesh agent 115 asia nepal agent 116 asia sri lanka agent 117 cis armenia agent 118 cis azerbaijan agent 119 cis georgia agent 120 europe liechtenstein agent table 1 samsung checkout service countries
Develop Smart Hospitality Display
apiavplayextension api to use samsung product api, <script type="text/javascript" src="$webapis/avplayextension/avplayextension js"></script> should be loaded in index html the module defines the functionalities of the player that are exposed and which could be easily used by an application or widget developer to support multimedia rtp/udp playback for audio or video that are provided by the tizen samsung product api since 6 5 product b2b htv remark webapp should include avplayextension js file in index html summary of interfaces and methods interface method avplaymanagerobject avplaymanager void open domstring url ;void close ;void prepare ;void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ;void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ;void play ;void stop ;avplayplayerstate getstate ;unsigned long getcurrenttime ;void setlistener avplayplaybackcallback playbackcallback ;domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ;void setdisplaymethod avplaydisplaymode displaymode ;void setselecttrack avplaystreamtype tracktype, long trackindex ;avplaystreaminfo getcurrentstreaminfo ;avplaystreaminfo[] gettotaltrackinfo ;void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ;domstring getversion ;void setdisplayrotation domstring displayrotation ; avplayplaybackcallback void onevent avplayevent eventid, domstring data ;void onerror avplayerror eventid ;void ondrmevent avplaydrmtype type, drmdata data ; 1 type definitions 1 1 avplayplayerstate this enumeration defines the player states enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; the following values are supported none indicates that the player is not created idle indicates that the player is created but not prepared ready indicates that the player is ready to play a media playing indicates that the player is playing a media paused indicates that the player is paused 1 2 avplaydisplaymode this enumeration defines the possible values for webapis avplay setdisplaymethod enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; the following values are supported player_display_mode_letter_box letter box mode player_display_mode_full_screen full screen mode player_display_mode_auto_aspect_ratio use the dar/par from the video info to show video 1 3 avplaystreamingpropertytype this enumeration specifies the values for a specific feature in udp/rtp enum avplaystreamingpropertytype { "enable_ttx", "set_interactive_mode" }; the following values are supported enable_ttx sets the player to handle ttx dataservice in streams it has one string parameter, which is either "true" or "false" for setstreamingproperty set_interactive_mode enables the interactive mode which sets the latency to the player it has two parameters, one is the "mode" and the other is the "latency" for setstreamingproperty the mode value can be 0 off and 1 on , the latency must be given in milliseconds 1 4 avplaydrmtype this enumeration specifies the different drm types defined by the player enum avplaydrmtype { "proidiom", "lynk" }; the following values are supported proidiom indicates drm type is pro idiom lynk indicates drm type is lynkdrm scas 1 5 avplaydrmoperation this enumeration defines the different drm operations by the player enum avplaydrmoperation { "initialize", "finalize" }; the following values are supported initialize initializes the drm instance for further processing finalize finalizes the drm instance which was created earlier this must be done at the end before closing the player instance 1 6 avplaystreamtype this enumeration defines the stream types defined by the player enum avplaystreamtype { "video", "audio", "text" }; the following values are supported video indicates the video track audio indicates the audio track text indicates the subtitle track 1 7 avplayerror this enumeration defines the player error message types defined by the player enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_invalid_operation", "player_error_invalid_state", "player_error_not_supported_file", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; the following values are supported player_error_none indicates that the operation is successfully completed player_error_invalid_parameter if the player finds any parameter which a caller is trying to configure on it to be incorrect, this error is generated player_error_invalid_operation indicates an invalid api call at the moment player_error_invalid_state indicates the error that is generated when any api is called in a state where it is not suggested to be called refer to apis description for valid states player_error_not_supported_file indicates the error that is generated, when required multimedia components are not available to play the given content player_error_invalid_uri indicates an error that is generated when an input uri is in the invalid format player_error_connection_failed indicates the error that is generated, when no data is coming from the network player_error_genereic if the player fails to create a display window, this error is generated 1 8 avplayevent this enumeration defines the events that come from the player enum avplayevent { "player_msg_none", "player_streaming_event" }; the following values are supported player_msg_none notifies that a multimedia component message is not recognized by the player player_streaming_event any type of streaming data that the caller needs would be posted through this event 1 9 avplaystreaminfo the avplaystreaminfo dictionary specifies the streaming media-related information for the video, audio, and the subtitles during various streaming scenarios dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; the following values are supported index index value of the stream type type of the stream, either video, audio, or text extra_info domstring json string containing all the media-related information all stream types have an extra_info string //video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" //audio extra_info example "{"language" "fr","channels" "2","sample_rate" "48000","bit_rate" "256000","fourcc" "mpeg","track_lang" "fra","audio_type" "0"}" //text subtitle extra_info example "{"track_lang" "eng","subtitle_type" "0","pid" "258","subtitle_mode" "0"}" if the stream type is invalid, the domstring becomes null and the index value becomes -1 1 10 drmdata the drmdata dictionary specifies information about the data received from the player via the drm event dictionary drmdata { domstring name; long code; domstring message; long reserved; }; the following values are supported name name for the message received from the player code signifies the drm error code message drm error message generally, it is a human readable message reserved reserved for future use 2 interfaces 2 1 avplaymanagerobject the interface defines what is instantiated by the webapi object of the tizen-based samsung tv product api there will be a webapis object that allows access to the functionality of the avplay api [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; attributes readonly avplaymanager avplay namespace for the avplay api 2 2 avplaymanager this interface provides methods to use the avplay functionalities [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; void play ; void stop ; avplayplayerstate getstate ; unsigned long getcurrenttime ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo getcurrentstreaminfo ; avplaystreaminfo gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; domstring getversion ; void setdisplayrotation domstring displayrotation ; }; methods open this method instantiates the player object and takes the content url as the input parameter void open domstring url ; product b2b htv constraint can be called in the following states "none", "idle" privilege level partner privilege http //developer samsung com/privilege/streamingtvplayer parameters url the url of content to play it supports udp and rtp multicast urls exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay open url ; } catch e { console log e ; } close this method destroys the avplay object void close ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused" , "playing" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example try { webapis avplay close ; } catch e { console log e ; } prepare this method prepares the media player for playback the player must have been created beforehand with a valid uri this prepare method is synchronous hence, the calling context would be blocked until the player is prepared void prepare ; product b2b htv constraint can be called in the following states "idle", "ready" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if the given url through open is invalid //for example, webapis avplay open "invalidurl" with error type invalidaccesserror, if the given url through open is valid but have outside multicast range //for example, webapis avplay open "udp //219 10 10 10" with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay prepare ; } catch e { console log e ; } prepareasync this method prepares the media player for playback, asynchronously this api prepares the mm core module, asynchronously it means that the internal media elements will change the state, asynchronously we recommend this asynchronous prepareasync call instead of the prepare call which is synchronous api which blocks the entire application during its execution prepareasync returns immediately, rather than blocking until enough data has been buffered since this works in asynchronous model, this does not block the executing thread and the application is responsive during its execution when prepareasync gets successfully completed, it returns with successcallback and player reached in ready state for some reason, e g network error, it returns with errorcallback with error value void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; product b2b htv constraint can be called in the following states "idle", "ready" parameters successcallback [optional][nullable] callback method to be invoked when this api is successful errorcallback [optional][nullable] callback method to invoke when an error occurs this function has one parameter which shows the following errortypes notsupportederror, if this feature is not supported invalidvalueserror, if the given url through open is invalid e g , webapis avplay open "invalidurl" invalidaccesserror, if the given url through open is valid, but does not exist or network issue e g , webapis avplay open "http //abc" invalidstateerror, if it is called in an invalid state unknownerror, for any other error exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with the expected type code example webapis avplay prepareasync = function successcallback, errorcallback { if typeof successcallback === 'undefined' { successcallback = null; } if typeof errorcallback === 'undefined' { errorcallback = null; } try { webapis epavplay prepareasync successcallback, errorcallback ; } catch e { logerror e ; throw e ; } }; setdisplayrect this method sets the display area for playing the video content on the tv screen it should be called for showing the video after calling an open method app's default resolution is 1920x1080 it needs 4 parameters left,top,width,height that always use 1920 x 1080 coordinate system regardless of your application resolution void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; product b2b htv constraint can be called in the following states "idle", "paused", "ready", "playing" parameters x coordinate of the display area in the tv screen coordinates this x value is smaller than the tv screen width y coordinate of the display area in the tv screen coordinates this y value is smaller than the tv screen height width the width of the display area this value is smaller than the width of the tv screen height the height of the display area from the source image this value is smaller than the height of the source image exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay setdisplayrect 0, 0, 1920, 1080 ; } catch e { console log e ; } play this method starts the playback of the stream void play ; product b2b htv constraint can be called in the following states "ready", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example try { webapis avplay play ; } catch e { console log e ; } stop this method stops the player and hence any video that is currently being played void stop ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused", "playing" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example try { webapis avplay stop ; } catch e { console log e ; } getstate this method returns the current state of the underlying player which is associated with the avplay object avplayplayerstate getstate ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value avplayplayerstate returns the state of the player "none", "idle", "ready", "playing", "paused" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var bret = webapis avplay getstate ; getcurrenttime this method returns the current play time in milliseconds unsigned long getcurrenttime ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "playing", "paused" return value unsigned long current playback time in milliseconds exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var currentplaytime = webapis avplay getcurrenttime ; setlistener this method is used in order to obtain the player information, the drm mode information etc , and the callback function is registered when the relevant event occurs, the relevant callback function gets called asynchronously void setlistener avplayplaybackcallback playbackcallback ; product b2b htv constraint can be called in the following states "none", "idle" recommended , "ready", "paused", "playing" but it is highly recommended to call this api just after player_status_idle for onerror, onevent, ondrmevent, it must be in player_status_idle i e just after player is created , otherwise the necessary information will be missed parameters playbackcallback avplayplaybackcallback exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type unknownerror in any other error case code example var listener = { onevent function eventtype, eventdata { console log "event type error " + eventtype + ", data " + eventdata ; }, onerror function eventtype { console log "event type error " + eventtype ; }, ondrmevent function drmevent, drmdata { console log "drm callback " + drmevent + ", data " + drmdata ; } } webapis avplay setlistener listener ; setdrm this method updates the drm information, such as setproperties, etc it changes the drm mode, and runs the control feature every drm has difference between avplaydrmoperation and jsonparam domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; product b2b htv constraint can be called in the following states "idle" privilege level public privilege http //developer samsung com/privilege/drmplay parameters drmtype is the type of the drm drmoperation avplaydrmoperation this is a string parameter which specifies the drm operation to be performed for the current playback session it can have these values{"initialize", "finalize" } "setproperties" this operation is used when the drm related information is stringified in "json_string" format and passed along with this operation this is mainly used for setting the drm information like license server, etc //example setting license server some of the code examples are given below jsonparam domstring drm parameter represented by json string not object the application can call json stringify to generate json string in java script the above given drm operation examples could be stringified in this json_string param return value domstring "true" in case of success and "false" if fails exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type securityerror, if the application does not have the privilege to call this method with error type invalidstateerror, if it is called in an invalid state, "none" with error type unknownerror in any other error case during failure scenarios this api would post an exception the following could be the possible exception scenarios drm create failed if creation of the underlying drm module failed, an exception would be sent back with "false" return status of this api call invalid drm session if an invalid drm session is detected, an exception would be sent back with "false" return status of this api call drm configuration failure if a drm configuration failure is detected, an exception would be sent back with "false" return status of this api call note if you use this api, a special privilege level is required insert the http //developer samsung com/privilege/drmplay in the config xml file of the web application check below example <tizen privilege name="http //developer samsung com/privilege/drmplay"/> code example // example proidiom setting forensic data var drmparam = new object ; drmparam forensicdata = "xxxxxxx"; playerobj setdrm "proidiom", "initialize", json stringify drmparam ; // example lynkdrm setting type and lynk server var drmparam = new object ; drmparam type ="2"; drmparam lynkserver="xxx xxx xxx xxx xxxxx"; playerobj setdrm "lynk", "initialize", json stringify drmparam ; setdisplaymethod this method sets the video screen mode within the given display area void setdisplaymethod avplaydisplaymode displaymode ; product b2b htv constraint can be called in the following states "idle", "paused", "ready", "playing" limitation this api works when set as setdisplayrect 0,0,1920,1080 parameters displaymode could be one of "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example webapis avplay setdisplaymethod "player_display_mode_full_screen" ; setselecttrack this method is used with multi audio/subtitle, when you want to change the audio and subtitle while playing void setselecttrack avplaystreamtype tracktype, long trackindex ; product b2b htv constraint can be called in the following state "playing" parameters tracktype it may be audio or text value trackindex it sets the index value of the avplaystreaminfo obtained through the webapis avplay gettotaltrackinfo function exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var totaltrackinfo = webapis avplay gettotaltrackinfo ; for var i=0; i<totaltrackinfo length; i++ { if totaltrackinfo type == 'text' { console log 'find subtitle track ' ; console log 'subtitle track index is ' + totaltrackinfo index ; console log 'subtitle track language is ' + totaltrackinfo extra_info track_lang ; } } //for example, choose the subtitle track index number 2 webapis avplay setselecttrack 'text',2 ; getcurrentstreaminfo this method gets the currently playing streams video, audio, and subtitle information it informs that a stream is playing avplaystreaminfo getcurrentstreaminfo ; product b2b htv constraint can be called in the following states "playing" return value avplaystreaminfo avplaystreaminfo structure containing tracktype, extrainfo and index of current stream exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var streaminfo = webapis avplay getcurrentstreaminfo ; var text = ''; for var i = 0; i < streaminfo length; i++ { text += 'index ' + streaminfo[i] index + ''; text += 'type ' + streaminfo[i] type + ''; text += 'extra_info ' + streaminfo[i] extra_info + ''; } all of stream type has extra_info which is jsonstring //video extra_info example "{fourcc "h264","width" "1920","height" "1080","bit_rate" " 477000"}" //audio extra_info example "{"language" "fr","channels" "2","sample_rate" "48000","bit_rate" "256000","fourcc" "mpeg","track_lang" "fra","audio_type" "0"}" //text subtitle extra_info example "{"track_lang" "eng","subtitle_type" "0","pid" "258","subtitle_mode" "0"}" in the case of invalid stream, the domstring becomes null and the index value becomes -1 gettotaltrackinfo this method gets the currently playing streams information avplaystreaminfo[] gettotaltrackinfo ; product b2b htv constraint can be called in the following state "playing" return value avplaystreaminfo avplaystreaminfo[] structure containing the tracktype, extrainfo, and the index of current stream it returns information for all the available tracks for the entire stream that is available in the current playback the following structure is used to send the information back to the caller for video tracks "{"fourcc" "%s","width" "%u","height" "%u","bit_rate" "%u"}" for audio track "{"language" "%s","channels" "%d","sample_rate" "%d","bit_rate" "%d","fourcc" "%s","track_lang" "%s","audio_type" "%d"}" for subtitle tracks "{"track_lang" "%s","subtitle_type" "%d","pid" "%d","subtitle_mode" "%s"}" exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example var trackinfo = webapis avplay gettotaltrackinfo ; var text = 'type of track info ' + typeof trackinfo + ''; text += 'length ' + trackinfo length + ''; for var i = 0; i<trackinfo length; i++ { text += 'index ' + trackinfo[i] index + ''; text += 'type ' + trackinfo[i] type + ''; text += 'extra_info ' + trackinfo[i] extra_info + ''; } setstreamingproperty this method sets the value for a specific feature in the udp/rtp playback void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; product b2b htv constraint can be called in the following player state "idle" parameters propertytype property type to be set to the player propparam value according to the propertytype e g "enable_ttx" propetytypes are true, false, and for the "set_interactive_mode" mode is 1 with latency in milliseconds exceptions webapiexception with error type typemismatcherror, if the input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any of the input parameters contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror in any other error case code example //set interactive mode example var propparam = new object ; propparam mode ="1"; propparam latency="100"; //latency in ms webapis avplay setstreamingproperty "set_interactive_mode", propparam ; //enable ttx mode example webapis avplay setstreamingproperty "enable_ttx", true ; getversion this method gets the version of avplay domstring getversion ; product b2b htv constraint can be called in the following states "none", "idle", "ready", "paused", "playing" return value domstring domstring string current version exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example var version = webapis avplay getversion ; setdisplayrotation this method sets the rotation settings of the video surface display if no display is set, no operation is performed use this method to change the video orientation to portrait mode this api call will change the origin of the coordinates hence, the application should call setdisplayrect again after calling this api void setdisplayrotation domstring displayrotation ; product b2b htv constraint can be called in the following states "idle", "ready", "playing", "paused" parameters displayrotation the rotation of the display the valid values for the display rotation are "player_display_rotation_none", "player_display_rotation_90", "player_display_rotation_180", "player_display_rotation_270" exceptions webapiexception with error type typemismatcherror, if an input parameter is not compatible with the expected type with error type notsupportederror, if this feature is not supported with error type invalidvalueserror, if any input parameter contains an invalid value with error type invalidstateerror, if it is called in an invalid state with error type unknownerror, for any other error code example webapis avplay setdisplayrotation "player_display_rotation_90" ; 2 3 avplayplaybackcallback this callback interface defines subscriptions for any notification on the buffering, playback [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void ondrmevent avplaydrmtype type, drmdata data ; }; methods onevent this method gets called async when some kind of event other event is received from the player void onevent avplayevent eventid, domstring data ; parameters eventid id of the event triggered by the player data description of the event received from the player exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example onevent function eventid, data { console log "onevent callback with eventtype " + eventid ; } onerror this method gets called when an error event is received from the player void onerror avplayerror eventid ; parameters eventid id of the error event trigerred by the player exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example onerror function eventid { console log "onerror event callback with eventtype " + eventid ; } ondrmevent this method gets called when the drm information is received from the player void ondrmevent avplaydrmtype type, drmdata data ; parameters type drm type data detailed information about the drm event received from the player { readonly attribute name name for the message, means an error occurred during the drm processing readonly attribute code signifies the drm error code readonly attribute message drm error message readonly attribute reserved not currently applicable } exceptions webapiexception with error type notsupportederror, if this feature is not supported with error type unknownerror in any other error case code example ondrmevent function type, data { console log "drm callback " + type + ", data " + data ; var errorinfo = { "name" data name, "error_code" data code, "error_message" data message // generally, the error message is human readable } } 3 full webidl module avplayextension { enum avplayplayerstate { "none", "idle", "ready", "playing", "paused" }; enum avplaydisplaymode { "player_display_mode_letter_box", "player_display_mode_full_screen", "player_display_mode_auto_aspect_ratio" }; enum avplaystreamingpropertytype { "enable_ttx", "set_interactive_mode" }; enum avplaydrmtype { "proidiom", "lynk" }; enum avplaydrmoperation { "initialize", "finalize" }; enum avplaystreamtype { "video", "audio", "text" }; enum avplayerror { "player_error_none", "player_error_invalid_parameter", "player_error_invalid_operation", "player_error_invalid_state", "player_error_not_supported_file", "player_error_invalid_uri", "player_error_connection_failed", "player_error_genereic" }; enum avplayevent { "player_msg_none", "player_streaming_event" }; dictionary avplaystreaminfo { unsigned long index; avplaystreamtype type; domstring extra_info; }; dictionary drmdata { domstring name; long code; domstring message; long reserved; }; [nointerfaceobject] interface avplaymanagerobject { readonly attribute avplaymanager avplay; }; webapi implements avplaymanagerobject; [nointerfaceobject] interface avplaymanager { void open domstring url ; void close ; void prepare ; void prepareasync optional successcallback? successcallback, optional errorcallback? errorcallback ; void setdisplayrect unsigned long x, unsigned long y, unsigned long width, unsigned long height ; void play ; void stop ; avplayplayerstate getstate ; unsigned long getcurrenttime ; void setlistener avplayplaybackcallback playbackcallback ; domstring setdrm avplaydrmtype drmtype, avplaydrmoperation drmoperation, domstring jsonparam ; void setdisplaymethod avplaydisplaymode displaymode ; void setselecttrack avplaystreamtype tracktype, long trackindex ; avplaystreaminfo getcurrentstreaminfo ; avplaystreaminfo[] gettotaltrackinfo ; void setstreamingproperty avplaystreamingpropertytype propertytype, any propparam ; domstring getversion ; void setdisplayrotation domstring displayrotation ; }; [callback=functiononly, nointerfaceobject] interface avplayplaybackcallback { void onevent avplayevent eventid, domstring data ; void onerror avplayerror eventid ; void ondrmevent avplaydrmtype type, drmdata data ; }; };
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
These cookies collect information about how you use our website. for example which pages you visit most often. All information these cookies collect is used to improve how the website works.
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and tailor the website to provide enhanced features and content for you.
You have successfully updated your cookie preferences.