diff --git a/com.twin.app.shoptime/README.md b/com.twin.app.shoptime/README.md index 5ffedecf..422daa79 100644 --- a/com.twin.app.shoptime/README.md +++ b/com.twin.app.shoptime/README.md @@ -79,3 +79,7 @@ SubCategory.jsx 참고(Home) } } ``` + +# 자막영상 + +ontv4u 검색 후 첫 영상 diff --git a/com.twin.app.shoptime/src/App/App.js b/com.twin.app.shoptime/src/App/App.js index e294bc48..f49e6bd8 100644 --- a/com.twin.app.shoptime/src/App/App.js +++ b/com.twin.app.shoptime/src/App/App.js @@ -10,6 +10,7 @@ import { changeAppStatus, getDeviceId, getHttpHeaderForServiceRequest, + getSystemSettings, } from "../actions/commonActions"; import { getAuthenticationCode } from "../actions/deviceActions"; import { @@ -131,10 +132,7 @@ function AppBase(props) { } dispatch(getDeviceId()); dispatch(getHttpHeaderForServiceRequest()); - //todo subscribe - // dispatch(getSystemSettings()); - // //get captionEnable - // dispatch(getSystemSettings2()); + dispatch(getSystemSettings()); // dispatch(getSystemInfo()); document.addEventListener("visibilitychange", visibilityChanged); document.addEventListener("webOSRelaunch", handleRelaunchEvent); diff --git a/com.twin.app.shoptime/src/actions/commonActions.js b/com.twin.app.shoptime/src/actions/commonActions.js index 20ec827e..629b8637 100644 --- a/com.twin.app.shoptime/src/actions/commonActions.js +++ b/com.twin.app.shoptime/src/actions/commonActions.js @@ -57,6 +57,26 @@ export const alertToast = (payload) => (dispatch, getState) => { } }; +export const getSystemSettings = + () => (dispatch, getState) => { + console.log("getSystemSettings "); + lunaSend.getSystemSettings({"category":"caption", "keys": ["captionEnable"]},{ + onSuccess: (res) => { + }, + onFailure: (err) => { + + }, + onComplete: (res) => { + console.log("getSystemSettings onComplete",res); + if(res && res.settings){ + if(typeof res.settings.captionEnable !== 'undefined'){ + dispatch(changeAppStatus({captionEnable: res.settings.captionEnable})); + } + } + } + }); + }; + export const getHttpHeaderForServiceRequest = (onComplete) => (dispatch, getState) => { console.log("getHttpHeaderForServiceRequest "); diff --git a/com.twin.app.shoptime/src/actions/playActions.js b/com.twin.app.shoptime/src/actions/playActions.js index 7a434937..5aaa5638 100644 --- a/com.twin.app.shoptime/src/actions/playActions.js +++ b/com.twin.app.shoptime/src/actions/playActions.js @@ -99,22 +99,31 @@ export const getSubTitle = dispatch({ type: types.GET_SUBTITLE, - payload: response.data.data, + payload: {url: showSubtitleUrl, data: response.data.data}, }); }; const onFail = (error) => { console.error("getSubTitle onFail", error); + dispatch({ + type: types.GET_SUBTITLE, + payload: {url: showSubtitleUrl, data: "Error"}, + }); }; - TAxios( - dispatch, - getState, - "get", - URLS.SUBTITLE, - { showSubtitleUrl }, - {}, - onSuccess, - onFail - ); + if(!getState().play.subTitleBlobs[showSubtitleUrl]){ + TAxios( + dispatch, + getState, + "get", + URLS.SUBTITLE, + { showSubtitleUrl }, + {}, + onSuccess, + onFail + ); + }else{ + console.log("playActions getSubTitle no Nothing it's exist", showSubtitleUrl); + } + }; diff --git a/com.twin.app.shoptime/src/components/VideoPlayer/Media.js b/com.twin.app.shoptime/src/components/VideoPlayer/Media.js new file mode 100644 index 00000000..f246b06d --- /dev/null +++ b/com.twin.app.shoptime/src/components/VideoPlayer/Media.js @@ -0,0 +1,391 @@ +"use strict"; +/* eslint-disable */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Media = exports.handledMediaEventsMap = exports.getKeyFromSource = exports["default"] = void 0; + +var _dispatcher = require("@enact/core/dispatcher"); + +var _handle = require("@enact/core/handle"); + +var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types")); + +var _propTypes2 = _interopRequireDefault(require("prop-types")); + +var _react = _interopRequireDefault(require("react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +/** + * Generates a key representing the source node or nodes provided + * + * Example: + * ``` + * getKeyFromSource('path/file.mp4'); // 'path/file.mp4' + * getKeyFromSource( + * + * ); // 'path/file.mp4' + * getKeyFromSource([ + * , + * , + * ]); // 'path/file.mp4+path/file.ogg' + * ``` + * + * @function + * @param {String|Element|Element[]} source URI for a source, `` node, or array of + * `` nodes + * @returns {String} Key representing sources + * @memberof ui/Media + * @public + */ +var getKeyFromSource = function getKeyFromSource() { + var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + + if ( /*#__PURE__*/_react["default"].isValidElement(source)) { + return _react["default"].Children.toArray(source).filter(function (s) { + return !!s; + }).map(function (s) { + return s.props.src; + }).join('+'); + } + + return String(source); +}; +/** + * Maps standard media event `type` values to React-style callback prop names + * + * See https://reactjs.org/docs/events.html#media-events + * + * ``` + * { + * abort : 'onAbort', + * canplay : 'onCanPlay', + * canplaythrough : 'onCanPlayThrough', + * durationchange : 'onDurationChange', + * emptied : 'onEmptied', + * encrypted : 'onEncrypted', + * ended : 'onEnded', + * error : 'onError', + * loadeddata : 'onLoadedData', + * loadedmetadata : 'onLoadedMetadata', + * loadstart : 'onLoadStart', + * pause : 'onPause', + * play : 'onPlay', + * playing : 'onPlaying', + * progress : 'onProgress', + * ratechange : 'onRateChange', + * seeked : 'onSeeked', + * seeking : 'onSeeking', + * stalled : 'onStalled', + * suspend : 'onSuspend', + * timeupdate : 'onTimeUpdate', + * volumechange : 'onVolumeChange', + * waiting : 'onWaiting' + * } + * ``` + * + * @typedef {Object} handledMediaEventsMap + * @memberof ui/Media + * @public + */ + + +exports.getKeyFromSource = getKeyFromSource; +var handledMediaEventsMap = { + abort: 'onAbort', + canplay: 'onCanPlay', + canplaythrough: 'onCanPlayThrough', + durationchange: 'onDurationChange', + emptied: 'onEmptied', + encrypted: 'onEncrypted', + ended: 'onEnded', + error: 'onError', + loadeddata: 'onLoadedData', + loadedmetadata: 'onLoadedMetadata', + loadstart: 'onLoadStart', + pause: 'onPause', + play: 'onPlay', + playing: 'onPlaying', + progress: 'onProgress', + ratechange: 'onRateChange', + seeked: 'onSeeked', + seeking: 'onSeeking', + stalled: 'onStalled', + suspend: 'onSuspend', + timeupdate: 'onTimeUpdate', + volumechange: 'onVolumeChange', + waiting: 'onWaiting' +}; +/** + * A component representation of HTMLMediaElement. + * + * @class Media + * @memberof ui/Media + * @ui + * @public + */ + +exports.handledMediaEventsMap = handledMediaEventsMap; + +var Media = /*#__PURE__*/function (_React$Component) { + _inherits(Media, _React$Component); + + var _super = _createSuper(Media); + + function Media(props) { + var _this; + + _classCallCheck(this, Media); + + _this = _super.call(this, props); + + _this.attachCustomMediaEvents = function () { + for (var eventName in _this.handledCustomMediaForwards) { + (0, _dispatcher.on)(eventName, _this.handledCustomMediaForwards[eventName], _this.media); + } + }; + + _this.detachCustomMediaEvents = function () { + for (var eventName in _this.handledCustomMediaForwards) { + (0, _dispatcher.off)(eventName, _this.handledCustomMediaForwards[eventName], _this.media); + } + }; + + _this.handleEvent = function (ev) { + (0, _handle.forward)('onUpdate', { + type: 'onUpdate' + }, _this.props); // fetch the forward() we generated earlier, using the event type as a key to find the real event name. + + var fwd = _this.handledMediaForwards[handledMediaEventsMap[ev.type]]; + + if (fwd) { + fwd(ev, _this.props); + } + }; + + _this.mediaRef = function (node) { + _this.media = node; + }; + + _this.media = null; + _this.handledMediaForwards = {}; + _this.handledMediaEvents = {}; + _this.handledCustomMediaForwards = {}; // Generate event handling forwarders and a smooth block to pass to